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

#   Decimal quantity plugin not working anymore

##

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

Less More

- Posts: 209
- Thank you received: 14
-
-
-
- [](http://www.r2h.nl)
-

9 years 7 months ago [\#265832](#265832) by [Rixters](/forum/user/28762-rixters "View Rixters's Profile")  *[Decimal quantity plugin not working anymore](/forum/31-development/889531-decimal-quantity-plugin-not-working-anymore#265832 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 3.6.x -- Browser(s) name and version -- : FF  Hi Hika team,  A while ago I made a plugin to use a custom field to set a decimal quantity for a product. I noticed that a couple of people are using the plugin so I would like to get things fixed.  Due to the changes in Hikashop 3 the plugin isn't working anymore. Can you tell me how I can update the cart? Previously I used the following code to update the individual products in the cart:  As reference , you can find the code on line 97 in the repo.   github.com/RickR2H/hikashop-decimal-quan.../custom&#95;pricer2h.php  The original post about the plugin:   www.hikashop.com/forum/development/88546...a-plugin.html#245183  Thanks in advance!")* was created by *[Rixters](/forum/user/28762-rixters "View Rixters's Profile")*

-- HikaShop version -- : 3.0.1
-- Joomla version -- : 3.6.5
-- PHP version -- : 3.6.x
-- Browser(s) name and version -- : FF

Hi Hika team,

A while ago I made a plugin to use a custom field to set a decimal quantity for a product. I noticed that a couple of people are using the plugin so I would like to get things fixed.

Due to the changes in Hikashop 3 the plugin isn't working anymore. Can you tell me how I can update the cart? Previously I used the following code to update the individual products in the cart: Code:

$currencyClass-&gt;quantityPrices($product-&gt;prices,$quantity,$product-&gt;cart_product_total_quantity);

As reference , you can find the code on line 97 in the repo.
[ github.com/RickR2H/hikashop-decimal-quan.../custom\_pricer2h.php](https://github.com/RickR2H/hikashop-decimal-quantity/blob/master/custom_pricer2h.php)

The original post about the plugin:
[ www.hikashop.com/forum/development/88546...a-plugin.html#245183](https://www.hikashop.com/forum/development/885467-add-product-to-cart-using-a-plugin.html#245183)

Thanks in advance!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4OTUzMS1kZWNpbWFsLXF1YW50aXR5LXBsdWdpbi1ub3Qtd29ya2luZy1hbnltb3JlP3RtcGw9bWFya2Rvd24=) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

9 years 7 months ago [\#265896](#265896) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Decimal quantity plugin not working anymore](/forum/31-development/889531-decimal-quantity-plugin-not-working-anymore#265896 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 3.6.x -- Browser(s) name and version -- : FF  Hi Hika team,  A while ago I made a plugin to use a custom field to set a decimal quantity for a product. I noticed that a couple of people are using the plugin so I would like to get things fixed.  Due to the changes in Hikashop 3 the plugin isn't working anymore. Can you tell me how I can update the cart? Previously I used the following code to update the individual products in the cart:  As reference , you can find the code on line 97 in the repo.   github.com/RickR2H/hikashop-decimal-quan.../custom&#95;pricer2h.php  The original post about the plugin:   www.hikashop.com/forum/development/88546...a-plugin.html#245183  Thanks in advance!")*

Hi,

I've tested the plugin myself and there is no change between HikaShop 2.x and HikaShop 3.x with it.
It works exactly the same.
However I did see a bug in the plugin.
If you set the taxes setting of the plugin to "no taxes", then, the price of the product on the checkout is the value you entered in the custom field and that's because you have that code: Code:

$product-&gt;prices[$k]-&gt;price_value = $product-&gt;$column; $product-&gt;prices[$k]-&gt;price_value_with_tax = $product-&gt;$column;

instead of Code:

$product-&gt;prices[$k]-&gt;price_value = $product_price; $product-&gt;prices[$k]-&gt;price_value_with_tax = $product_price;

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

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

Less More

- Posts: 209
- Thank you received: 14
-
-
-
- [](http://www.r2h.nl)
-

9 years 7 months ago [\#265923](#265923) by [Rixters](/forum/user/28762-rixters "View Rixters's Profile")  Replied by *[Rixters](/forum/user/28762-rixters "View Rixters's Profile")* on topic *[Decimal quantity plugin not working anymore](/forum/31-development/889531-decimal-quantity-plugin-not-working-anymore#265923 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 3.6.x -- Browser(s) name and version -- : FF  Hi Hika team,  A while ago I made a plugin to use a custom field to set a decimal quantity for a product. I noticed that a couple of people are using the plugin so I would like to get things fixed.  Due to the changes in Hikashop 3 the plugin isn't working anymore. Can you tell me how I can update the cart? Previously I used the following code to update the individual products in the cart:  As reference , you can find the code on line 97 in the repo.   github.com/RickR2H/hikashop-decimal-quan.../custom&#95;pricer2h.php  The original post about the plugin:   www.hikashop.com/forum/development/88546...a-plugin.html#245183  Thanks in advance!")*

Hi Nicolas,

I made some improvements to the plugin and everything seems to work now. There is only one issue that remains. In the old plugin I could manupulate the field value shown under the product title in the cart by using the following code: Code:

$product-&gt;$column = $product-&gt;$column . ' m - € ' . number_format(round($original_product_price, 2), 2, ',', ' ') .' / m1';

You can see my old code on line 94 and 95 in the repo.

Unfortunately this isn't working anymore. Do you have an idea how to change this info in the cart? Now only the field label is shown...
[ ![Afbeelding-6.jpg](/forum/attachment/37267) ](/forum/attachment/37267 "Afbeelding-6.jpg")

I hope you can help me!

Regards!

- [ ![Afbeelding-6.jpg](/forum/attachment/37267) ](/forum/attachment/37267 "Afbeelding-6.jpg") [ ](/forum/attachment/37267?download=1 "Afbeelding-6.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4OTUzMS1kZWNpbWFsLXF1YW50aXR5LXBsdWdpbi1ub3Qtd29ya2luZy1hbnltb3JlP3RtcGw9bWFya2Rvd24=) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

9 years 7 months ago [\#265946](#265946) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Decimal quantity plugin not working anymore](/forum/31-development/889531-decimal-quantity-plugin-not-working-anymore#265946 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 3.6.x -- Browser(s) name and version -- : FF  Hi Hika team,  A while ago I made a plugin to use a custom field to set a decimal quantity for a product. I noticed that a couple of people are using the plugin so I would like to get things fixed.  Due to the changes in Hikashop 3 the plugin isn't working anymore. Can you tell me how I can update the cart? Previously I used the following code to update the individual products in the cart:  As reference , you can find the code on line 97 in the repo.   github.com/RickR2H/hikashop-decimal-quan.../custom&#95;pricer2h.php  The original post about the plugin:   www.hikashop.com/forum/development/88546...a-plugin.html#245183  Thanks in advance!")*

Yes, we kind of blocked that.
You can change that by editing the file "show_block_cart" and changing the code: Code:

$item = $cart-&gt;cart_products[$i];

to: Code:

$item = $cart-&gt;products[$i];

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

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

Less More

- Posts: 209
- Thank you received: 14
-
-
-
- [](http://www.r2h.nl)
-

9 years 7 months ago [\#265992](#265992) by [Rixters](/forum/user/28762-rixters "View Rixters's Profile")  Replied by *[Rixters](/forum/user/28762-rixters "View Rixters's Profile")* on topic *[Decimal quantity plugin not working anymore](/forum/31-development/889531-decimal-quantity-plugin-not-working-anymore#265992 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 3.6.x -- Browser(s) name and version -- : FF  Hi Hika team,  A while ago I made a plugin to use a custom field to set a decimal quantity for a product. I noticed that a couple of people are using the plugin so I would like to get things fixed.  Due to the changes in Hikashop 3 the plugin isn't working anymore. Can you tell me how I can update the cart? Previously I used the following code to update the individual products in the cart:  As reference , you can find the code on line 97 in the repo.   github.com/RickR2H/hikashop-decimal-quan.../custom&#95;pricer2h.php  The original post about the plugin:   www.hikashop.com/forum/development/88546...a-plugin.html#245183  Thanks in advance!")*

Hi Nico,

Thanks! But maybe I have an other solution... The item price next to the title in the cart is updates on changing the custom field. Is it possible to just manipulate this values without changing the product total price? Then in this case the price in m1, the field value And the total price * field value is shown. Ideally I don't want to use overrides to keep thins as consistent and future proof as possible!

Thanks in advance!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4OTUzMS1kZWNpbWFsLXF1YW50aXR5LXBsdWdpbi1ub3Qtd29ya2luZy1hbnltb3JlP3RtcGw9bWFya2Rvd24=) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

9 years 7 months ago [\#265995](#265995) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Decimal quantity plugin not working anymore](/forum/31-development/889531-decimal-quantity-plugin-not-working-anymore#265995 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 3.6.x -- Browser(s) name and version -- : FF  Hi Hika team,  A while ago I made a plugin to use a custom field to set a decimal quantity for a product. I noticed that a couple of people are using the plugin so I would like to get things fixed.  Due to the changes in Hikashop 3 the plugin isn't working anymore. Can you tell me how I can update the cart? Previously I used the following code to update the individual products in the cart:  As reference , you can find the code on line 97 in the repo.   github.com/RickR2H/hikashop-decimal-quan.../custom&#95;pricer2h.php  The original post about the plugin:   www.hikashop.com/forum/development/88546...a-plugin.html#245183  Thanks in advance!")*

Hi,

Then, I would recommend instead to implement the onAfterCartProductsLoad trigger in your plugin:
[ www.hikashop.com/support/documentation/6...fterCartProductsLoad](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#onAfterCartProductsLoad)
That way, you can modify the array $cart-&gt;cart_products to change the value of the custom item field after the prices and products have been loaded and calculated for the cart.
In fact, you could even change the prices there too, but you would have to update the totals as well in that case so it would be more complex.

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

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

Less More

- Posts: 209
- Thank you received: 14
-
-
-
- [](http://www.r2h.nl)
-

9 years 7 months ago [\#266186](#266186) by [Rixters](/forum/user/28762-rixters "View Rixters's Profile")  Replied by *[Rixters](/forum/user/28762-rixters "View Rixters's Profile")* on topic *[Decimal quantity plugin not working anymore](/forum/31-development/889531-decimal-quantity-plugin-not-working-anymore#266186 "-- HikaShop version -- : 3.0.1 -- Joomla version -- : 3.6.5 -- PHP version -- : 3.6.x -- Browser(s) name and version -- : FF  Hi Hika team,  A while ago I made a plugin to use a custom field to set a decimal quantity for a product. I noticed that a couple of people are using the plugin so I would like to get things fixed.  Due to the changes in Hikashop 3 the plugin isn't working anymore. Can you tell me how I can update the cart? Previously I used the following code to update the individual products in the cart:  As reference , you can find the code on line 97 in the repo.   github.com/RickR2H/hikashop-decimal-quan.../custom&#95;pricer2h.php  The original post about the plugin:   www.hikashop.com/forum/development/88546...a-plugin.html#245183  Thanks in advance!")*

Thanks for your help!
Got the plugin working again!

The following user(s) said Thank You: [Jerome](/forum/user/80-jerome "View Jerome's Profile")

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

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