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

#   Products sometimes not added to cart

##

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

Less More

- Posts: 45
- Thank you received: 0
-
-

10 years 9 months ago [\#229320](#229320) by [Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")  *[Products sometimes not added to cart](/forum/31-development/882184-products-sometimes-not-added-to-cart#229320 "-- HikaShop version -- : 2.6.1 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.3.10  Hi,  I'm using the listing&#95;table to show products in rows. Because it is a long list I also wanted to place the Add to cart-button at the top of the page, instead of only at the bottom.  So i copied the code of the button to the top of listing&#95;table.php. But it seems that occasionally, maybe only the first time someone uses this button, the products are not added to the cart. Everything seems to go right, but if you go to the cart it is empty. People complain this is happening, I only could reproduce it one time. So not sure where to look.  Have any of you got any idea what could be the issue here?  The code I placed at the top of listing&#95;table.php is:  Thanks!")* was created by *[Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")*

-- HikaShop version -- : 2.6.1
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.3.10

Hi,

I'm using the listing_table to show products in rows. Because it is a long list I also wanted to place the Add to cart-button at the top of the page, instead of only at the bottom.

So i copied the code of the button to the top of listing_table.php. But it seems that occasionally, maybe only the first time someone uses this button, the products are not added to the cart. Everything seems to go right, but if you go to the cart it is empty. People complain this is happening, I only could reproduce it one time. So not sure where to look.

Have any of you got any idea what could be the issue here?

The code I placed at the top of listing_table.php is: Code:

&lt;?php if ($this-&gt;config-&gt;get('show_quantity_field')&gt;=2) { $this-&gt;ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form_'.$this-&gt;params-&gt;get('main_div_name').'\')){ return hikashopModifyQuantity(\'\',field,1,\'hikashop_product_form_'.$this-&gt;params-&gt;get('main_div_name').'\'); } return false;'; $this-&gt;row = null; $this-&gt;row-&gt;product_quantity = -1; $this-&gt;row-&gt;product_min_per_order = 0; $this-&gt;row-&gt;product_max_per_order = -1; $this-&gt;row-&gt;product_sale_start = 0; $this-&gt;row-&gt;product_sale_end = 0; $this-&gt;row-&gt;prices = array('filler'); $this-&gt;setLayout('quantity'); echo $this-&gt;loadTemplate(); if(!empty($this-&gt;ajax) &amp;&amp; $this-&gt;config-&gt;get('redirect_url_after_add_cart','stay_if_cart')=='ask_user'){ ?&gt; &lt;input type="hidden" name="popup" value="1"/&gt; &lt;?php } ?&gt; &lt;input type="hidden" name="hikashop_cart_type_0" id="hikashop_cart_type_0" value="cart"/&gt; &lt;input type="hidden" name="add" value="1"/&gt; &lt;input type="hidden" name="ctrl" value="product"/&gt; &lt;input type="hidden" name="task" value="updatecart"/&gt; &lt;input type="hidden" name="return_url" value="&lt;?php echo urlencode(base64_encode(urldecode($this-&gt;redirect_url)));?&gt;"/&gt; &lt;/form&gt; &lt;?php } if(in_array($pagination,array('bottom','both')) &amp;&amp; $this-&gt;params-&gt;get('show_limit') &amp;&amp; $this-&gt;pageInfo-&gt;elements-&gt;total){ $this-&gt;pagination-&gt;form = '_bottom'; ?&gt; &lt;form action="&lt;?php echo hikashop_currentURL(); ?&gt;" method="post" name="adminForm_&lt;?php echo $this-&gt;params-&gt;get('main_div_name').$this-&gt;category_selected;?&gt;_bottom"&gt; &lt;div class="hikashop_products_pagination hikashop_products_pagination_bottom"&gt; &lt;?php echo $this-&gt;pagination-&gt;getListFooter($this-&gt;params-&gt;get('limit')); ?&gt; &lt;span class="hikashop_results_counter"&gt;&lt;?php echo $this-&gt;pagination-&gt;getResultsCounter(); ?&gt;&lt;/span&gt; &lt;/div&gt; &lt;input type="hidden" name="filter_order_&lt;?php echo $this-&gt;params-&gt;get('main_div_name').$this-&gt;category_selected;?&gt;" value="&lt;?php echo $this-&gt;pageInfo-&gt;filter-&gt;order-&gt;value; ?&gt;" /&gt; &lt;input type="hidden" name="filter_order_Dir_&lt;?php echo $this-&gt;params-&gt;get('main_div_name').$this-&gt;category_selected;?&gt;" value="&lt;?php echo $this-&gt;pageInfo-&gt;filter-&gt;order-&gt;dir; ?&gt;" /&gt; &lt;?php echo JHTML::_( 'form.token' ); ?&gt; &lt;/form&gt; &lt;?php } ?&gt;

Thanks!

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

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

10 years 9 months ago [\#229351](#229351) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Products sometimes not added to cart](/forum/31-development/882184-products-sometimes-not-added-to-cart#229351 "-- HikaShop version -- : 2.6.1 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.3.10  Hi,  I'm using the listing&#95;table to show products in rows. Because it is a long list I also wanted to place the Add to cart-button at the top of the page, instead of only at the bottom.  So i copied the code of the button to the top of listing&#95;table.php. But it seems that occasionally, maybe only the first time someone uses this button, the products are not added to the cart. Everything seems to go right, but if you go to the cart it is empty. People complain this is happening, I only could reproduce it one time. So not sure where to look.  Have any of you got any idea what could be the issue here?  The code I placed at the top of listing&#95;table.php is:  Thanks!")*

Hello,
Your issue will depend on where you exactly moved that code on the "listing_table" file, so can you give us more information about it ?
Also, note that it won't work if you have moved these lines above these lines : Code:

&lt;?php foreach($this-&gt;rows as $row){ $this-&gt;row =&amp; $row;

If you want to debug your customization, the best solution will probably be to enable the Joomla debug mode and error reporting.

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

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

Less More

- Posts: 45
- Thank you received: 0
-
-

10 years 9 months ago [\#229408](#229408) by [Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")  Replied by *[Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")* on topic *[Products sometimes not added to cart](/forum/31-development/882184-products-sometimes-not-added-to-cart#229408 "-- HikaShop version -- : 2.6.1 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.3.10  Hi,  I'm using the listing&#95;table to show products in rows. Because it is a long list I also wanted to place the Add to cart-button at the top of the page, instead of only at the bottom.  So i copied the code of the button to the top of listing&#95;table.php. But it seems that occasionally, maybe only the first time someone uses this button, the products are not added to the cart. Everything seems to go right, but if you go to the cart it is empty. People complain this is happening, I only could reproduce it one time. So not sure where to look.  Have any of you got any idea what could be the issue here?  The code I placed at the top of listing&#95;table.php is:  Thanks!")*

Hi Mohamed,

I placed the full code at the top of the page, so right after Code:

defined('_JEXEC') or die('Restricted access'); ?&gt;

I want it to show at the top of the page. To be clear: it works most of the time.

Thanks again.

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

Less More

- Posts: 86359
- Thank you received: 14296
-
-

10 years 9 months ago [\#229427](#229427) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Products sometimes not added to cart](/forum/31-development/882184-products-sometimes-not-added-to-cart#229427 "-- HikaShop version -- : 2.6.1 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.3.10  Hi,  I'm using the listing&#95;table to show products in rows. Because it is a long list I also wanted to place the Add to cart-button at the top of the page, instead of only at the bottom.  So i copied the code of the button to the top of listing&#95;table.php. But it seems that occasionally, maybe only the first time someone uses this button, the products are not added to the cart. Everything seems to go right, but if you go to the cart it is empty. People complain this is happening, I only could reproduce it one time. So not sure where to look.  Have any of you got any idea what could be the issue here?  The code I placed at the top of listing&#95;table.php is:  Thanks!")*

That's the problem.
The quantity inputs and the button needs to be inside the &lt;form&gt; and &lt;/form&gt; tags.

If you look at the code you gave you can see that it's not the case:
[ take.ms/xLWsU](http://take.ms/xLWsU)
The add to cart button is now outside the form tags and the &lt;/form&gt; tag should be left at the end of the listing.

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

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

Less More

- Posts: 45
- Thank you received: 0
-
-

10 years 9 months ago [\#229563](#229563) by [Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")  Replied by *[Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")* on topic *[Products sometimes not added to cart](/forum/31-development/882184-products-sometimes-not-added-to-cart#229563 "-- HikaShop version -- : 2.6.1 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.3.10  Hi,  I'm using the listing&#95;table to show products in rows. Because it is a long list I also wanted to place the Add to cart-button at the top of the page, instead of only at the bottom.  So i copied the code of the button to the top of listing&#95;table.php. But it seems that occasionally, maybe only the first time someone uses this button, the products are not added to the cart. Everything seems to go right, but if you go to the cart it is empty. People complain this is happening, I only could reproduce it one time. So not sure where to look.  Have any of you got any idea what could be the issue here?  The code I placed at the top of listing&#95;table.php is:  Thanks!")*

Hi Nicolas,

I'm sorry, I don't understand your answer. The given code is exactly the same as the original code at the bottom of the page of listing_table.php. I only copied it to the top.

But, to take another approach, what do I need to do if I want the button on the top also?

Thanks again!

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

Less More

- Posts: 86359
- Thank you received: 14296
-
-

10 years 9 months ago [\#229571](#229571) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Products sometimes not added to cart](/forum/31-development/882184-products-sometimes-not-added-to-cart#229571 "-- HikaShop version -- : 2.6.1 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.3.10  Hi,  I'm using the listing&#95;table to show products in rows. Because it is a long list I also wanted to place the Add to cart-button at the top of the page, instead of only at the bottom.  So i copied the code of the button to the top of listing&#95;table.php. But it seems that occasionally, maybe only the first time someone uses this button, the products are not added to the cart. Everything seems to go right, but if you go to the cart it is empty. People complain this is happening, I only could reproduce it one time. So not sure where to look.  Have any of you got any idea what could be the issue here?  The code I placed at the top of listing&#95;table.php is:  Thanks!")*

Hi,

What you did is a good idea, but you need to remove the &lt;/form&gt; tag from the code that you copy/paste and you need to put your code after the &lt;form&gt; tag of the view.
That's basically what I hinted at in my previous message.

The following user(s) said Thank You: [Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")

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

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

Less More

- Posts: 45
- Thank you received: 0
-
-

10 years 8 months ago [\#229733](#229733) by [Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")  Replied by *[Squashtoppertje](/forum/user/39506-squashtoppertje "View Squashtoppertje's Profile")* on topic *[Products sometimes not added to cart](/forum/31-development/882184-products-sometimes-not-added-to-cart#229733 "-- HikaShop version -- : 2.6.1 -- Joomla version -- : 3.4.8 -- PHP version -- : 5.3.10  Hi,  I'm using the listing&#95;table to show products in rows. Because it is a long list I also wanted to place the Add to cart-button at the top of the page, instead of only at the bottom.  So i copied the code of the button to the top of listing&#95;table.php. But it seems that occasionally, maybe only the first time someone uses this button, the products are not added to the cart. Everything seems to go right, but if you go to the cart it is empty. People complain this is happening, I only could reproduce it one time. So not sure where to look.  Have any of you got any idea what could be the issue here?  The code I placed at the top of listing&#95;table.php is:  Thanks!")*

Hi Nicolas,

Thanks, I think I solved it by copying the complete code to after the form-tags. Not completely sure yet, but I will see if any users still got the problem.

This is wat I got now:
Code:

&lt;form action="&lt;?php echo hikashop_currentURL(); ?&gt;" method="post" name="adminForm_&lt;?php echo $this-&gt;params-&gt;get('main_div_name').$this-&gt;category_selected;?&gt;_bottom"&gt; &lt;input type="hidden" name="filter_order_&lt;?php echo $this-&gt;params-&gt;get('main_div_name').$this-&gt;category_selected;?&gt;" value="&lt;?php echo $this-&gt;pageInfo-&gt;filter-&gt;order-&gt;value; ?&gt;" /&gt; &lt;input type="hidden" name="filter_order_Dir_&lt;?php echo $this-&gt;params-&gt;get('main_div_name').$this-&gt;category_selected;?&gt;" value="&lt;?php echo $this-&gt;pageInfo-&gt;filter-&gt;order-&gt;dir; ?&gt;" /&gt; &lt;?php echo JHTML::_( 'form.token' ); ?&gt; &lt;/form&gt; &lt;?php if ($this-&gt;config-&gt;get('show_quantity_field')&gt;=2) { $this-&gt;ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form_'.$this-&gt;params-&gt;get('main_div_name').'\')){ return hikashopModifyQuantity(\'\',field,1,\'hikashop_product_form_'.$this-&gt;params-&gt;get('main_div_name').'\'); } return false;'; $this-&gt;row = null; $this-&gt;row-&gt;product_quantity = -1; $this-&gt;row-&gt;product_min_per_order = 0; $this-&gt;row-&gt;product_max_per_order = -1; $this-&gt;row-&gt;product_sale_start = 0; $this-&gt;row-&gt;product_sale_end = 0; $this-&gt;row-&gt;prices = array('filler'); $this-&gt;setLayout('quantity'); echo $this-&gt;loadTemplate(); if(!empty($this-&gt;ajax) &amp;&amp; $this-&gt;config-&gt;get('redirect_url_after_add_cart','stay_if_cart')=='ask_user'){ ?&gt; &lt;input type="hidden" name="popup" value="1"/&gt; &lt;?php } ?&gt; &lt;input type="hidden" name="hikashop_cart_type_0" id="hikashop_cart_type_0" value="cart"/&gt; &lt;input type="hidden" name="add" value="1"/&gt; &lt;input type="hidden" name="ctrl" value="product"/&gt; &lt;input type="hidden" name="task" value="updatecart"/&gt; &lt;input type="hidden" name="return_url" value="&lt;?php echo urlencode(base64_encode(urldecode($this-&gt;redirect_url)));?&gt;"/&gt; &lt;?php } if(in_array($pagination,array('bottom','both')) &amp;&amp; $this-&gt;params-&gt;get('show_limit') &amp;&amp; $this-&gt;pageInfo-&gt;elements-&gt;total){ $this-&gt;pagination-&gt;form = '_bottom'; ?&gt; &lt;?php } ?&gt;

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

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