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

#   Cart: How to add Custom Field value to prices?

##

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

Less More

- Posts: 73
- Thank you received: 0
-
-

11 years 5 months ago [\#203407](#203407) by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile")  *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#203407 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")* was created by *[sokartch](/forum/user/4482-sokartch "View sokartch's Profile")*

-- HikaShop version -- : HikaShop Business: 2.4.0
-- Joomla version -- : Joomla! 3.4.1

Hello

We create engravings as a service. There are start-up costs. I have defined for products a "custom fiels" (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.

File: checkout / cart.php

Line 147, is inserted:
if ($ this-&gt; row-&gt;field_fixkosten_artikel)
echo 'Vorbereitung für diesen Artikel ';

Line 258 (original 256), is inserted:
if ($ this-&gt; row-&gt; field_fixkosten_artikel)
{
/ * full_total-&gt; prices [0] -&gt; price_value += $ this-&gt; row-&gt; field_fixkosten_artikel * ????????? * /
$ this-&gt; full_total-&gt; prices [0] -&gt; price_value_with_tax += $ this-&gt; row-&gt; field_fixkosten_artikel;
echo $ this-&gt; row-&gt; field_fixkosten_artikel;
}

Questions:
- How do I get it formatted the same as the product price?
- How do I calculate the price without tax?

Regards,
Petar Ristanovic
[ www.sokart.ch](http://www.sokart.ch)

[ ![Add&#95;Custom&#95;Field&#95;Value.jpg](/forum/attachment/24713) ](/forum/attachment/24713 "...ield&#95;Value.jpg")

- [ ![Add&#95;Custom&#95;Field&#95;Value.jpg](/forum/attachment/24713) ](/forum/attachment/24713 "...ield&#95;Value.jpg") [ ](/forum/attachment/24713?download=1 "...ield&#95;Value.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NzI2OC1jYXJ0LWhvdy10by1hZGQtY3VzdG9tLWZpZWxkLXZhbHVlLXRvLXByaWNlcz90bXBsPW1hcmtkb3du) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 5 months ago [\#203476](#203476) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#203476 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hi,

In that case, you should not modify the views. You should instead create a product price override plugin to modify the price of the product based on the custom field.
You can use as an example the donation plugin: [ demo.hikashop.com/index.php/en/hikashop/...t-page/donation-page](http://demo.hikashop.com/index.php/en/hikashop/product-page/donation-page)

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

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

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

Less More

- Posts: 73
- Thank you received: 0
-
-

11 years 5 months ago [\#203515](#203515) by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile")  Replied by *[sokartch](/forum/user/4482-sokartch "View sokartch's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#203515 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Ok. I'll try it. Thank You Very Much.

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

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

Less More

- Posts: 73
- Thank you received: 0
-
-

11 years 5 months ago [\#203826](#203826) by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile")  Replied by *[sokartch](/forum/user/4482-sokartch "View sokartch's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#203826 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hello
I have business license but can not find a donation plugin in Joomla list.
What went wrong?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NzI2OC1jYXJ0LWhvdy10by1hZGQtY3VzdG9tLWZpZWxkLXZhbHVlLXRvLXByaWNlcz90bXBsPW1hcmtkb3du) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 5 months ago [\#203851](#203851) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#203851 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hi,

I don't see why the plugin wouldn't be there unless it has been manually uninstalled.
Do you still have the files in the folder plugins/system/custom_price/ ?
In that case, you can zip them and install the package manually via the Joomla installer like a normal extension and it will add it back.

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

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

Less More

- Posts: 73
- Thank you received: 0
-
-

11 years 5 months ago [\#203858](#203858) by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile")  Replied by *[sokartch](/forum/user/4482-sokartch "View sokartch's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#203858 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hi
I think, the problem was the name "HikaShopCustom Price plugin".
You wrote "You can use as an example the donation plugin..." and I searched for "donation"... Sorry.
Today, after "plugins/system/custom_price" i searched for "custom"...
Regards

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NzI2OC1jYXJ0LWhvdy10by1hZGQtY3VzdG9tLWZpZWxkLXZhbHVlLXRvLXByaWNlcz90bXBsPW1hcmtkb3du) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 5 months ago [\#203862](#203862) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#203862 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hi,

That's the old name of the donation plugin which has been changed a while back but which you would still have it you updated from an old version as the name of already installed plugins is not updated when you update HikaShop.

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

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

Less More

- Posts: 73
- Thank you received: 0
-
-

11 years 5 months ago [\#204111](#204111) by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile")  Replied by *[sokartch](/forum/user/4482-sokartch "View sokartch's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#204111 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hello
Sorry. I have to ask you again.
I have to add an amount to the sum of the product.
- Article (backend), I define the price eg USD 10.00 per piece and in the custom field USD 9.90 Preparation costs are not of this article.
- On the product side (front-end) I order 10 articles. In the "Specifications" I can see "Preparation costs 9.90".
---
Now I switch to the cart:
In the row for this product as I can see, USD 100, but I have to get 109.90
---
Do you really think that can do that a plug-in based on the donation (custom price) plugin?

Regards
Petar Ristanovic
[ www.sokart.ch](http://www.sokart.ch)

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

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

11 years 5 months ago [\#204170](#204170) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#204170 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hi,

I will more recommend you to use the "shipping price per product" or to use a custom plugin to set some "order additional".
You can also use a custom plugin to perform a product price override using the original product price and a custom field value ; but it won't give you the details for the "preparation cost" and the price will be "merge" with the product.
Placing the price into the shipping or in a separate field of the order footer will be more like your requirements.

Here a sample plugin for order additional use
[ www.hikashop.com/forum/checkout/872829-w...s-a-gift.html#179177](http://www.hikashop.com/forum/checkout/872829-wrap-the-articles-as-a-gift.html#179177)

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

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

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

Less More

- Posts: 73
- Thank you received: 0
-
-

11 years 5 months ago -  11 years 5 months ago [\#204743](#204743) by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile")  Replied by *[sokartch](/forum/user/4482-sokartch "View sokartch's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#204743 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hello

**Some products in a cart may have "flag". I needs to delete those products in the cart.**
public function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product_id,$quantity,$add,$type,$resetCartWhenUpdate,$force) {
$cartContent = $cartClass-&gt;get();
$c = $cartClass-&gt;loadFullCart();
if ( count($c-&gt;products) ) {
foreach($c-&gt;products as $product) {
if( !empty($product-&gt;field_forced) ) { // if product has been forced in the cart
??? how to delete a product/item
}
}
unset($product);
}
...

**For products in the basket certain products need to be added ...**
public function onAfterCartUpdate(&amp;$cartClass,&amp;$cart,$product_id,$quantity,$add,$type,$resetCartWhenUpdate,$force) {
$cartContent = $cartClass-&gt;get();
$c = $cartClass-&gt;loadFullCart();
if ( count($c-&gt;products) ) {
foreach($c-&gt;products as $product) {
if( !empty($product-&gt;field_vorbereitung) ) { // if product has preparation costs
??? how to add a product/item
}
}
unset($product);
}
...

In the discussions in the forum terms and examples are shown. Where can I find detailed descriptions of classes, members and methods?

Last edit: 11 years 5 months ago by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NzI2OC1jYXJ0LWhvdy10by1hZGQtY3VzdG9tLWZpZWxkLXZhbHVlLXRvLXByaWNlcz90bXBsPW1hcmtkb3du) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 5 months ago [\#204782](#204782) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#204782 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hi,

There are no detailed descriptions of classes, members and methods. No where.
Otherwise, we would have published it.
If you want to know what a function of a class does, you need to look at its file and read the code.
For example, for the cart manipulation functions, you can look at the file administrator/components/com_hikashop/classes/cart.php

However, the simplest would be to redirect to the add to cart URL of the product in order to add it (and with a quantity of 0 and the add to 0 in the URL to remove it).
[ www.hikashop.com/forum/4-how-to/48848-ad...tom-page-solved.html](http://www.hikashop.com/forum/4-how-to/48848-add-to-cart-and-redirect-to-custom-page-solved.html)

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

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

Less More

- Posts: 73
- Thank you received: 0
-
-

11 years 5 months ago -  11 years 5 months ago [\#205050](#205050) by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile")  Replied by *[sokartch](/forum/user/4482-sokartch "View sokartch's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#205050 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hello

---
However, the simplest would be to redirect to the add to cart URL of the product in order to add it (and with a quantity of 0 and the add to 0 in the URL to remove it).
---
My feeling tells me that it will not work from a function triggered ...
public function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product_id,$quantity,$add,$type,$resetCartWhenUpdate,$force) {

If yes: How do I remove a product in **onBeforeCartUpdate**  from the cart?

I'm desperate and think about giving up. Two days I try to understand the source and to find a way.

Again:

- I need for certain products "preparatory costs" as a product to add.
- I have developed a own plugin ...
- Adding product works well in the
public function onAfterCartUpdate(&amp;$cartClass,&amp;$cart,$product_id,$quantity,$add,$type,$resetCartWhenUpdate,$force) {
$cartContent = $cartClass-&gt;get();
$c = $cartClass-&gt;loadFullCart();
if ( count($c-&gt;products) ) {
foreach($c-&gt;products as $product) {
if( !empty($product-&gt;field_vorbereitung) ) { // if product has preparation costs
$cartClass-&gt;updateEntry('1',$cartContent,(int)$product-&gt;field_vorbereitung,'1',false,$type,$force);
}
}
unset($product);
}
...

I want to delete items marked with (in backend I set **field\_forced = '1';**) in:
public function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product_id,$quantity,$add,$type,$resetCartWhenUpdate,$force) {
$cartContent = $cartClass-&gt;get();
$c = $cartClass-&gt;loadFullCart();
if ( count($c-&gt;products) ) {
foreach($c-&gt;products as $product) {
if( !empty($product-&gt;field_forced) ) { // if product is "preparation costs"
?????????????????
}
}
unset($product);
}

In this way the list is always up to date when the "real" products will be deleted.

Regards!

Last edit: 11 years 5 months ago by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NzI2OC1jYXJ0LWhvdy10by1hZGQtY3VzdG9tLWZpZWxkLXZhbHVlLXRvLXByaWNlcz90bXBsPW1hcmtkb3du) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 5 months ago [\#205051](#205051) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#205051 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hi,

You could try with:
$cartClass-&gt;updateEntry(0,$cartContent,(int)$product-&gt;cart_product_id,0,false,$type,$force);

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

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

Less More

- Posts: 73
- Thank you received: 0
-
-

11 years 5 months ago -  11 years 5 months ago [\#205186](#205186) by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile")  Replied by *[sokartch](/forum/user/4482-sokartch "View sokartch's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#205186 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hi

Yes, I'm still alive ![:)](/media/kunena/emoticons/3.png ":)")

- I was able to organize without deleting product from basket. Snapshuss "First.jpg"

[ ![First.jpg](/forum/attachment/24947) ](/forum/attachment/24947 "First.jpg")

- I now have a problem if I will add the same product twice in the basket. I expect that only the number in the basket will be updated. Image "Second.jpg". For this, the total price calculation is incorrect. I could not find the cause. Do You have an idea?

[ ![Second.jpg](/forum/attachment/24948) ](/forum/attachment/24948 "Second.jpg")

The Database (phpMyAdmin)

[ ![Third.jpg](/forum/attachment/24949) ](/forum/attachment/24949 "Third.jpg")

- [ ![First.jpg](/forum/attachment/24947) ](/forum/attachment/24947 "First.jpg") [ ](/forum/attachment/24947?download=1 "First.jpg")
- [ ![Second.jpg](/forum/attachment/24948) ](/forum/attachment/24948 "Second.jpg") [ ](/forum/attachment/24948?download=1 "Second.jpg")
- [ ![Third.jpg](/forum/attachment/24949) ](/forum/attachment/24949 "Third.jpg") [ ](/forum/attachment/24949?download=1 "Third.jpg")

Last edit: 11 years 5 months ago by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NzI2OC1jYXJ0LWhvdy10by1hZGQtY3VzdG9tLWZpZWxkLXZhbHVlLXRvLXByaWNlcz90bXBsPW1hcmtkb3du) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 5 months ago [\#205191](#205191) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#205191 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

I think that you want to add the line:
$cartClass-&gt;mainProduct = null;
in you code before the updateEntry, otherwise, the system thinks that the extra product you add is an option of the product and it gets messed up.

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

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

Less More

- Posts: 73
- Thank you received: 0
-
-

11 years 5 months ago -  11 years 5 months ago [\#205287](#205287) by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile")  Replied by *[sokartch](/forum/user/4482-sokartch "View sokartch's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#205287 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hi
- It has improved with the main product and price mess.
- Additional product does not seem to be properly "registered". It adds him repeatedly (at Add to cart of main product) instead to increase his account. In the database I can not detect a difference between products.... This may be the cause that we can not delete this "addional" article.
Our client is getting impatient, we can ever solve this problem?

Product add, delete or change places should be provided in the Cart class. This should be able to be used in the plug-ins without side effects.

[ ![Database.jpg](/forum/attachment/24972) ](/forum/attachment/24972 "Database.jpg")

- [ ![Database.jpg](/forum/attachment/24972) ](/forum/attachment/24972 "Database.jpg") [ ](/forum/attachment/24972?download=1 "Database.jpg")

Last edit: 11 years 5 months ago by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NzI2OC1jYXJ0LWhvdy10by1hZGQtY3VzdG9tLWZpZWxkLXZhbHVlLXRvLXByaWNlcz90bXBsPW1hcmtkb3du) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 5 months ago [\#205353](#205353) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#205353 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hi,

The product being duplicated by updateEntry happens when it checks if another product in the cart already has the same product_id, the same custom item fields values and the same options. It's done in the big Code:

if($type=='product'){

block of code in the updateEntry function of the class.cart. I don't see why that wouldn't work.

The cart class was never meant to be used by other developers. On top of that, the structure dates from 5 years ago at a lot to it has been added to it to support the many functionalities we added in that time rendering it a lot more cryptic than it was meant.
We're aware of that.
We're actually rewriting the whole add to cart system to make it clean, faster, more powerful and simpler to use.

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

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

Less More

- Posts: 73
- Thank you received: 0
-
-

11 years 5 months ago [\#205910](#205910) by [sokartch](/forum/user/4482-sokartch "View sokartch's Profile")  Replied by *[sokartch](/forum/user/4482-sokartch "View sokartch's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#205910 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hi

I solved almost all the problems ...

**Delete a product:**
public function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product_id,$quantity,$add,$type,$resetCartWhenUpdate,$force) {
...
$cartClass-&gt;updateEntry(0,$cartContent,(int)$product-&gt;cart_product_id,0,false,'item',$force);
...
}

**Add a product:**
public function onAfterCartUpdate(&amp;$cartClass,&amp;$cart,$product_id,$quantity,$add,$type,$resetCartWhenUpdate,$force) {
...
$cartClass-&gt;mainProduct = null;
$cartClass-&gt;updateEntry('1',$cartContent,(int)$product-&gt;field_vorbereitung,'1',false,'product',$force);
...
}

I have this code to change the price of a product. But so calculated prices will not be applied in the Shopping Cart. Why and what can I do?
---
public function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product_id,$quantity,$add,$type,$resetCartWhenUpdate,$force) {
$price_factor = 1.0;
$cartContent = $cartClass-&gt;get();
$c = $cartClass-&gt;loadFullCart();
if ( count($c-&gt;products) ) {
foreach($c-&gt;products as $product) {
if (!empty($product-&gt;field_must_be_engraved)) {
$price_factor = (float)$product-&gt;field_preis_faktor;
} else if (empty($product-&gt;field_forced)) {
$product-&gt;prices[0]-&gt;unit_price-&gt;price_value *= $price_factor;
$product-&gt;prices[0]-&gt;unit_price-&gt;price_value_with_tax *= $price_factor;
$product-&gt;prices[0]-&gt;price_value *= $price_factor;
$product-&gt;prices[0]-&gt;price_value_with_tax *= $price_factor;
...
}
---

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NzI2OC1jYXJ0LWhvdy10by1hZGQtY3VzdG9tLWZpZWxkLXZhbHVlLXRvLXByaWNlcz90bXBsPW1hcmtkb3du) 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?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

11 years 5 months ago [\#205930](#205930) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart: How to add Custom Field value to prices?](/forum/27-checkout/877268-cart-how-to-add-custom-field-value-to-prices#205930 "-- HikaShop version -- : HikaShop Business: 2.4.0 -- Joomla version -- : Joomla! 3.4.1  Hello  We create engravings as a service. There are start-up costs. I have defined for products a &quot;custom fiels&quot; (text). There, the initial costs are entered in the backend. Now I want to show this also in the cart and add to the subtotal and total price.  File: checkout / cart.php  Line 147, is inserted: if ($ this-&gt; row-&gt;field&#95;fixkosten&#95;artikel) echo 'Vorbereitung für diesen Artikel ';  Line 258 (original 256), is inserted: if ($ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel) { / &#42; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel &#42; ????????? &#42; / $ this-&gt; full&#95;total-&gt; prices &#91;0&#93; -&gt; price&#95;value&#95;with&#95;tax += $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; echo $ this-&gt; row-&gt; field&#95;fixkosten&#95;artikel; }  Questions: - How do I get it formatted the same as the product price? - How do I calculate the price without tax?  Regards, Petar Ristanovic   www.sokart.ch")*

Hi,

The prices of the products are loaded and calculated dynamically on each page. Setting them in the $products array in the onBeforeCartUpdate won't do anything.

If you want to override the prices of products in the cart, what you want is to take example on the donation plugin of HikaShop:
[ demo.hikashop.com/index.php/en/hikashop/...t-page/donation-page](http://demo.hikashop.com/index.php/en/hikashop/product-page/donation-page)
It overrides the price of the products in the cart (what you want to do)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NzI2OC1jYXJ0LWhvdy10by1hZGQtY3VzdG9tLWZpZWxkLXZhbHVlLXRvLXByaWNlcz90bXBsPW1hcmtkb3du) 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.096 seconds

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