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

#   Which API to use for custom field &amp; characteristic

##

- **[ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")**
- [![ler@singmuiheng.com's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile") Topic Author
- [ Offline](/forum/user/3330-ler-singmuiheng-com)

Less More

- Posts: 575
- Thank you received: 11
-
-

10 years 6 months ago [\#237455](#237455) by [ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")  *[Which API to use for custom field &amp; characteristic](/forum/31-development/884003-which-api-to-use-for-custom-field-characteristic#237455 "-- HikaShop version -- : 2.6.2 -- Joomla version -- : 3.5.2 -- PHP version -- : 5.4.45  We would like to do some customization on characteristic and custom field to control pricing and quantity of product order  may i know which API is for manipulate these?")* was created by *[ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")*

-- HikaShop version -- : 2.6.2
-- Joomla version -- : 3.5.2
-- PHP version -- : 5.4.45

We would like to do some customization on characteristic and custom field to control pricing and quantity of product order

may i know which API is for manipulate these?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4NDAwMy13aGljaC1hcGktdG8tdXNlLWZvci1jdXN0b20tZmllbGQtY2hhcmFjdGVyaXN0aWM/dG1wbD1tYXJrZG93bg==) 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
-
-

10 years 6 months ago [\#237466](#237466) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Which API to use for custom field &amp; characteristic](/forum/31-development/884003-which-api-to-use-for-custom-field-characteristic#237466 "-- HikaShop version -- : 2.6.2 -- Joomla version -- : 3.5.2 -- PHP version -- : 5.4.45  We would like to do some customization on characteristic and custom field to control pricing and quantity of product order  may i know which API is for manipulate these?")*

Hi,

You probably want to look at the plugin that we provide in the section "How to sell products by Width and Length ?" of our FAQ:
[ www.hikashop.com/support/documentation/106-faq.html#cart](https://www.hikashop.com/support/documentation/106-faq.html#cart)

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

- **[ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")**
- [![ler@singmuiheng.com's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile") Topic Author
- [ Offline](/forum/user/3330-ler-singmuiheng-com)

Less More

- Posts: 575
- Thank you received: 11
-
-

10 years 6 months ago -  10 years 6 months ago [\#238164](#238164) by [ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")  Replied by *[ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")* on topic *[Which API to use for custom field &amp; characteristic](/forum/31-development/884003-which-api-to-use-for-custom-field-characteristic#238164 "-- HikaShop version -- : 2.6.2 -- Joomla version -- : 3.5.2 -- PHP version -- : 5.4.45  We would like to do some customization on characteristic and custom field to control pricing and quantity of product order  may i know which API is for manipulate these?")*

Dear Nicolas

thanks for this plugin, this is exactly what we are looking for when use together with display limited to function

however when we change the custom field from text -&gt; single dropdown, it doesn't seem to work any more

below are our edited code, please let us know if we make something wrong Code:

&lt;?php jimport('joomla.plugin.plugin'); class plgSystemCustom_quantity_width_length extends JPlugin{ } if(!function_exists('hikashop_product_price_for_quantity_in_cart') &amp;&amp; !function_exists('hikashop_product_price_for_quantity_in_order')) { function hikashop_product_price_for_quantity_in_cart(&amp;$product){ $currencyClass = hikashop_get('class.currency'); $quantity = @$product-&gt;cart_product_quantity; if(!empty($product-&gt;left2) &amp;&amp; !empty($product-&gt;right2)){ $quantity = $quantity*2; } $currencyClass-&gt;quantityPrices($product-&gt;prices,$quantity,$product-&gt;cart_product_total_quantity); } function hikashop_product_price_for_quantity_in_order(&amp;$product){ $quantity = $product-&gt;order_product_quantity; if(!empty($product-&gt;left2) &amp;&amp; !empty($product-&gt;right2)){ $quantity = $quantity*2; } $product-&gt;order_product_total_price_no_vat = $product-&gt;order_product_price*$quantity; $product-&gt;order_product_total_price = ($product-&gt;order_product_price+$product-&gt;order_product_tax)*$quantity; } }

Last edit: 10 years 6 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile"). Reason: code tags missing

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4NDAwMy13aGljaC1hcGktdG8tdXNlLWZvci1jdXN0b20tZmllbGQtY2hhcmFjdGVyaXN0aWM/dG1wbD1tYXJrZG93bg==) 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
-
-

10 years 6 months ago [\#238178](#238178) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Which API to use for custom field &amp; characteristic](/forum/31-development/884003-which-api-to-use-for-custom-field-characteristic#238178 "-- HikaShop version -- : 2.6.2 -- Joomla version -- : 3.5.2 -- PHP version -- : 5.4.45  We would like to do some customization on characteristic and custom field to control pricing and quantity of product order  may i know which API is for manipulate these?")*

Hi,

In your code, the important part is: Code:

if(!empty($product-&gt;left2) &amp;&amp; !empty($product-&gt;right2)){ $quantity = $quantity*2; }

There, you basically say: when the custom fields "left2" and "right2" have been filled/selected, multiple the quantity of the product by 2.
But you actually don't use the values selected in the fields. Please look again at the code of the plugin we provide in our FAQ. You'll see there that we do use the values of the fields to update the quantity: Code:

$quantity = $quantity*$product-&gt;length*$product-&gt;width;

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

- **[ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")**
- [![ler@singmuiheng.com's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile") Topic Author
- [ Offline](/forum/user/3330-ler-singmuiheng-com)

Less More

- Posts: 575
- Thank you received: 11
-
-

10 years 4 months ago [\#244157](#244157) by [ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")  Replied by *[ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")* on topic *[Which API to use for custom field &amp; characteristic](/forum/31-development/884003-which-api-to-use-for-custom-field-characteristic#244157 "-- HikaShop version -- : 2.6.2 -- Joomla version -- : 3.5.2 -- PHP version -- : 5.4.45  We would like to do some customization on characteristic and custom field to control pricing and quantity of product order  may i know which API is for manipulate these?")*

Dear Nicolas

the plugin are working all fine but we face a problem when we enable point reward

the rewarded point do not have the quantity x 2 calculation

is it possible to correct this on the same plugin or it should modify the userpoint plugin code?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4NDAwMy13aGljaC1hcGktdG8tdXNlLWZvci1jdXN0b20tZmllbGQtY2hhcmFjdGVyaXN0aWM/dG1wbD1tYXJrZG93bg==) 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
-
-

10 years 4 months ago [\#244179](#244179) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Which API to use for custom field &amp; characteristic](/forum/31-development/884003-which-api-to-use-for-custom-field-characteristic#244179 "-- HikaShop version -- : 2.6.2 -- Joomla version -- : 3.5.2 -- PHP version -- : 5.4.45  We would like to do some customization on characteristic and custom field to control pricing and quantity of product order  may i know which API is for manipulate these?")*

Hi,

Can you provide the code of the plugin you're using and a screenshot of the settings of your user points plugin ?

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

- **[ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")**
- [![ler@singmuiheng.com's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile") Topic Author
- [ Offline](/forum/user/3330-ler-singmuiheng-com)

Less More

- Posts: 575
- Thank you received: 11
-
-

10 years 4 months ago [\#244243](#244243) by [ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")  Replied by *[ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")* on topic *[Which API to use for custom field &amp; characteristic](/forum/31-development/884003-which-api-to-use-for-custom-field-characteristic#244243 "-- HikaShop version -- : 2.6.2 -- Joomla version -- : 3.5.2 -- PHP version -- : 5.4.45  We would like to do some customization on characteristic and custom field to control pricing and quantity of product order  may i know which API is for manipulate these?")*

Attached our plugin for everyone, some minor modification and creation of custom field is needed in order to use this plugin

it is suitable to change the quantity/pricing base on the custom field customer selected

below are the code, we simply determine the field selected and multiply the final checkout value by 2

however, the point award was not multiply by 2
Code:

&lt;?php jimport('joomla.plugin.plugin'); class plgSystemCustom_quantity_width_length extends JPlugin{ } if(!function_exists('hikashop_product_price_for_quantity_in_cart') &amp;&amp; !function_exists('hikashop_product_price_for_quantity_in_order')) { function hikashop_product_price_for_quantity_in_cart(&amp;$product){ $currencyClass = hikashop_get('class.currency'); $quantity = @$product-&gt;cart_product_quantity; if((!empty($product-&gt;left2) &amp;&amp; !empty($product-&gt;right2)) &#124;&#124; (!empty($product-&gt;left3) &amp;&amp; !empty($product-&gt;right3)) &#124;&#124; (!empty($product-&gt;left_0to850) &amp;&amp; !empty($product-&gt;right_0to850)) &#124;&#124; (!empty($product-&gt;left_05to10) &amp;&amp; !empty($product-&gt;right_05to10)) &#124;&#124; (!empty($product-&gt;left_0to9) &amp;&amp; !empty($product-&gt;right_0to9)) &#124;&#124; (!empty($product-&gt;left_075to9) &amp;&amp; !empty($product-&gt;right_075to9)) &#124;&#124;(!empty($product-&gt;left_1to9) &amp;&amp; !empty($product-&gt;right_1to9)) &#124;&#124; (!empty($product-&gt;left_0to6) &amp;&amp; !empty($product-&gt;right_0to6)) &#124;&#124; (!empty($product-&gt;left_050to12) &amp;&amp; !empty($product-&gt;right_050to12))) { $quantity = $quantity*2; } $currencyClass-&gt;quantityPrices($product-&gt;prices,$quantity,$product-&gt;cart_product_total_quantity); } function hikashop_product_price_for_quantity_in_order(&amp;$product){ $quantity = $product-&gt;order_product_quantity; if((!empty($product-&gt;left2) &amp;&amp; !empty($product-&gt;right2)) &#124;&#124; (!empty($product-&gt;left3) &amp;&amp; !empty($product-&gt;right3)) &#124;&#124; (!empty($product-&gt;left_0to850) &amp;&amp; !empty($product-&gt;right_0to850)) &#124;&#124; (!empty($product-&gt;left_05to10) &amp;&amp; !empty($product-&gt;right_05to10)) &#124;&#124; (!empty($product-&gt;left_0to9) &amp;&amp; !empty($product-&gt;right_0to9)) &#124;&#124; (!empty($product-&gt;left_075to9) &amp;&amp; !empty($product-&gt;right_075to9)) &#124;&#124;(!empty($product-&gt;left_1to9) &amp;&amp; !empty($product-&gt;right_1to9)) &#124;&#124; (!empty($product-&gt;left_0to6) &amp;&amp; !empty($product-&gt;right_0to6)) &#124;&#124; (!empty($product-&gt;left_050to12) &amp;&amp; !empty($product-&gt;right_050to12))) { $quantity = $quantity*2; } $product-&gt;order_product_total_price_no_vat = $product-&gt;order_product_price*$quantity; $product-&gt;order_product_total_price = ($product-&gt;order_product_price+$product-&gt;order_product_tax)*$quantity; } }

this is the point plugin setting page

[ ![Lensfit&#95;-&#95;Administration&#95;-&#95;Plugin&#95;&#95;userpoints.png](/forum/attachment/32357) ](/forum/attachment/32357 "...userpoints.png")

- [ ![Lensfit&#95;-&#95;Administration&#95;-&#95;Plugin&#95;&#95;userpoints.png](/forum/attachment/32357) ](/forum/attachment/32357 "...userpoints.png") [ ](/forum/attachment/32357?download=1 "...userpoints.png")

The following user(s) said Thank You: [Xavier](/forum/user/4105-xavier "View Xavier's Profile")

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

- **[ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")**
- [![ler@singmuiheng.com's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile") Topic Author
- [ Offline](/forum/user/3330-ler-singmuiheng-com)

Less More

- Posts: 575
- Thank you received: 11
-
-

10 years 4 months ago [\#244512](#244512) by [ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")  Replied by *[ler@singmuiheng.com](/forum/user/3330-ler-singmuiheng-com "View ler@singmuiheng.com's Profile")* on topic *[Which API to use for custom field &amp; characteristic](/forum/31-development/884003-which-api-to-use-for-custom-field-characteristic#244512 "-- HikaShop version -- : 2.6.2 -- Joomla version -- : 3.5.2 -- PHP version -- : 5.4.45  We would like to do some customization on characteristic and custom field to control pricing and quantity of product order  may i know which API is for manipulate these?")*

Dear Xavier

Our problem is not solved yet

Main problem, although the checout price is multiply by 2

the awarded point is not

Is it possible to manipulate the awarded point during checkout of this plugin?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4NDAwMy13aGljaC1hcGktdG8tdXNlLWZvci1jdXN0b20tZmllbGQtY2hhcmFjdGVyaXN0aWM/dG1wbD1tYXJrZG93bg==) 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
-
-

10 years 4 months ago [\#244579](#244579) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Which API to use for custom field &amp; characteristic](/forum/31-development/884003-which-api-to-use-for-custom-field-characteristic#244579 "-- HikaShop version -- : 2.6.2 -- Joomla version -- : 3.5.2 -- PHP version -- : 5.4.45  We would like to do some customization on characteristic and custom field to control pricing and quantity of product order  may i know which API is for manipulate these?")*

Hi,

You should try removing the "product category" category from the "product categories" setting of your user points plugin. With it, the system has to recalculate the amount of the products which will give points, starting from the unit price of the products in the order ( and thus, it circumvents the price calculation override that you've implemented). If you remove it, it directly uses the total of the order and thus it will take into account your override of the calculations.

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

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