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

#   Using hikashopModifyQuantity

##

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

Less More

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

11 years 10 months ago -  11 years 10 months ago [\#187289](#187289) by [jmtodd](/forum/user/8200-jmtodd "View jmtodd's Profile")  *[Using hikashopModifyQuantity](/forum/31-development/874354-using-hikashopmodifyquantity#187289 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.3 -- Browser(s) name and version -- : Safari 7.1.2  A couple of years ago I developed a theatre ticketing linked to Hikashop to sell tickets for our society's performances and everything worked well. People could click on the seat they wanted and the ticket would be added to the basket. If they changed their mind, they could click on the seat again and the ticket would be removed from the basket. This was achieved through a javascript module which essentially called hikashopModifyQuantity (see below), passing it either +1 or -1 as required.  I have now upgraded to the latest version of Hikashop and this no longer seems to work. It adds the seat just as before - but clicking on the seat again no longer removes it. It appears that hikashopModifyQuantity no longer accepts negative amounts. Is that right? And, if so, is there another way to achieve what I need to do?  Many thanks! Jonathan")* was created by *[jmtodd](/forum/user/8200-jmtodd "View jmtodd's Profile")*

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.3
-- Browser(s) name and version -- : Safari 7.1.2

A couple of years ago I developed a theatre ticketing linked to Hikashop to sell tickets for our society's performances and everything worked well. People could click on the seat they wanted and the ticket would be added to the basket. If they changed their mind, they could click on the seat again and the ticket would be removed from the basket. This was achieved through a javascript module which essentially called hikashopModifyQuantity (see below), passing it either +1 or -1 as required.

I have now upgraded to the latest version of Hikashop and this no longer seems to work. It adds the seat just as before - but clicking on the seat again no longer removes it. It appears that hikashopModifyQuantity no longer accepts negative amounts. Is that right? And, if so, is there another way to achieve what I need to do?

Many thanks!
Jonathan
Code:

// function toggles seat image and alters quantity in basket function toggleSeat(seatID,productID,category) { var x=document.getElementById(seatID).innerHTML; var product; // final product ID (corresponding to adult or concession) var y; var field = new jmt_field; if (x.search("seat-category") &gt; 0) { y=getRadioCheckedValue("ticket_type_form","ticket_type"); if (y == "Concession") { document.getElementById(seatID).innerHTML="&lt;img src=\"http://myco.org.uk/seat-chosen-concession.gif\" title="+seatID+"&gt;"; product = productID + 2; } else { document.getElementById(seatID).innerHTML="&lt;img src=\"http://myco.org.uk/seat-chosen.gif\" title="+seatID+"&gt;"; product = productID + 1; } field.value = 1; } else { if (x.search("concession") &gt; 0) { product = productID + 2; } else { product = productID + 1; } document.getElementById(seatID).innerHTML="&lt;img src=\"http://myco.org.uk/seat-category"+category+".gif\" title="+seatID+"&gt;"; field.value = 0; } if (hikashopCheckChangeForm('item','hikashop_product_form')) { return hikashopModifyQuantity(product,field,1,0,'cart'); } else { return false; } }

Last edit: 11 years 10 months ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile"). Reason: [code] is nice !

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3NDM1NC11c2luZy1oaWthc2hvcG1vZGlmeXF1YW50aXR5P3RtcGw9bWFya2Rvd24=) 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 10 months ago -  11 years 10 months ago [\#187310](#187310) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Using hikashopModifyQuantity](/forum/31-development/874354-using-hikashopmodifyquantity#187310 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.3 -- Browser(s) name and version -- : Safari 7.1.2  A couple of years ago I developed a theatre ticketing linked to Hikashop to sell tickets for our society's performances and everything worked well. People could click on the seat they wanted and the ticket would be added to the basket. If they changed their mind, they could click on the seat again and the ticket would be removed from the basket. This was achieved through a javascript module which essentially called hikashopModifyQuantity (see below), passing it either +1 or -1 as required.  I have now upgraded to the latest version of Hikashop and this no longer seems to work. It adds the seat just as before - but clicking on the seat again no longer removes it. It appears that hikashopModifyQuantity no longer accepts negative amounts. Is that right? And, if so, is there another way to achieve what I need to do?  Many thanks! Jonathan")*

Hi,

The 3th parameter of the javascript function hikashopModifyQuantity is the parameter "add" ; it allow you to say if you want to add some quantity or replace the current cart quantity.
So with "add = 1", you can add "1" item.

But I see that you use Code:

field.value = 0;

which means that you shouldn't use the "add = 1" at this moment.
Because you're trying to add "0" items in the cart.. You don't want to add the quantity, you want to replace it.

Regards,

---

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

Last edit: 11 years 10 months ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile"). Reason: [code] is nice

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

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

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

Less More

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

11 years 10 months ago [\#187456](#187456) by [jmtodd](/forum/user/8200-jmtodd "View jmtodd's Profile")  Replied by *[jmtodd](/forum/user/8200-jmtodd "View jmtodd's Profile")* on topic *[Using hikashopModifyQuantity](/forum/31-development/874354-using-hikashopmodifyquantity#187456 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.3 -- Browser(s) name and version -- : Safari 7.1.2  A couple of years ago I developed a theatre ticketing linked to Hikashop to sell tickets for our society's performances and everything worked well. People could click on the seat they wanted and the ticket would be added to the basket. If they changed their mind, they could click on the seat again and the ticket would be removed from the basket. This was achieved through a javascript module which essentially called hikashopModifyQuantity (see below), passing it either +1 or -1 as required.  I have now upgraded to the latest version of Hikashop and this no longer seems to work. It adds the seat just as before - but clicking on the seat again no longer removes it. It appears that hikashopModifyQuantity no longer accepts negative amounts. Is that right? And, if so, is there another way to achieve what I need to do?  Many thanks! Jonathan")*

Brilliant! You're a star! Now works fine.

Many thanks!
Jonathan

PS. Are these things documented anywhere?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg3NDM1NC11c2luZy1oaWthc2hvcG1vZGlmeXF1YW50aXR5P3RtcGw9bWFya2Rvd24=) 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 10 months ago [\#187461](#187461) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Using hikashopModifyQuantity](/forum/31-development/874354-using-hikashopmodifyquantity#187461 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.3 -- Browser(s) name and version -- : Safari 7.1.2  A couple of years ago I developed a theatre ticketing linked to Hikashop to sell tickets for our society's performances and everything worked well. People could click on the seat they wanted and the ticket would be added to the basket. If they changed their mind, they could click on the seat again and the ticket would be removed from the basket. This was achieved through a javascript module which essentially called hikashopModifyQuantity (see below), passing it either +1 or -1 as required.  I have now upgraded to the latest version of Hikashop and this no longer seems to work. It adds the seat just as before - but clicking on the seat again no longer removes it. It appears that hikashopModifyQuantity no longer accepts negative amounts. Is that right? And, if so, is there another way to achieve what I need to do?  Many thanks! Jonathan")*

Hi,

Our developer documentation does not have the javascript functions ; the fact is that I want to rewrite a big part of them in order to rearrange them and if possible, use javascript objects.
I also planned to add some javascript triggers in HikaShop pages so it will become easier to plug some JS code to catch specific events.

Regards,

---

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

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

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