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

#   Invalid argument for foreach() cart.php line 1491

##

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

Less More

- Posts: 8
- Thank you received: 0
-
-

13 years 11 months ago [\#74551](#74551) by [tommytom](/forum/user/11095-tommytom "View tommytom's Profile")  *[Invalid argument for foreach() cart.php line 1491](/forum/3-bug-report/74551-invalid-argument-for-foreach-cart-php-line-1491#74551 "Hello, I have this message when displaying the payment method page  Warning: Invalid argument supplied for foreach() in /home/&#42;&#42;&#42;&#42;&#42;&#42;&#42;&#42;/administrator/components/com&#95;hikashop/classes/cart.php on line 1491  Apparently, the variable $subs has not been initialized or is not an array.  Can you please check it ?  Thanks for your help. -Tom")* was created by *[tommytom](/forum/user/11095-tommytom "View tommytom's Profile")*

Hello, I have this message when displaying the payment method page

Warning: Invalid argument supplied for foreach() in /home/********/administrator/components/com_hikashop/classes/cart.php on line 1491

Apparently, the variable $subs has not been initialized or is not an array.

Can you please check it ?

Thanks for your help.
-Tom

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83NDU1MS1pbnZhbGlkLWFyZ3VtZW50LWZvci1mb3JlYWNoLWNhcnQtcGhwLWxpbmUtMTQ5MT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 11 months ago [\#74563](#74563) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Re: Invalid argument for foreach() cart.php line 1491](/forum/3-bug-report/74551-invalid-argument-for-foreach-cart-php-line-1491#74563 "Hello, I have this message when displaying the payment method page  Warning: Invalid argument supplied for foreach() in /home/&#42;&#42;&#42;&#42;&#42;&#42;&#42;&#42;/administrator/components/com&#95;hikashop/classes/cart.php on line 1491  Apparently, the variable $subs has not been initialized or is not an array.  Can you please check it ?  Thanks for your help. -Tom")*

Hi,

Can you try to replace: Code:

foreach($subs as $value){ if(isset($value-&gt;recurring) &amp;&amp; $value-&gt;recurring == '1'){ $durations[$i] = $value-&gt;duration; $recurring++; } $i++; }

By: Code:

if(isset($subs) &amp;&amp; !empty($subs)){ foreach($subs as $value){ if(isset($value-&gt;recurring) &amp;&amp; $value-&gt;recurring == '1'){ $durations[$i] = $value-&gt;duration; $recurring++; } $i++; } }

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83NDU1MS1pbnZhbGlkLWFyZ3VtZW50LWZvci1mb3JlYWNoLWNhcnQtcGhwLWxpbmUtMTQ5MT90bXBsPW1hcmtkb3du) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 8
- Thank you received: 0
-
-

13 years 11 months ago [\#74570](#74570) by [tommytom](/forum/user/11095-tommytom "View tommytom's Profile")  Replied by *[tommytom](/forum/user/11095-tommytom "View tommytom's Profile")* on topic *[Re: Invalid argument for foreach() cart.php line 1491](/forum/3-bug-report/74551-invalid-argument-for-foreach-cart-php-line-1491#74570 "Hello, I have this message when displaying the payment method page  Warning: Invalid argument supplied for foreach() in /home/&#42;&#42;&#42;&#42;&#42;&#42;&#42;&#42;/administrator/components/com&#95;hikashop/classes/cart.php on line 1491  Apparently, the variable $subs has not been initialized or is not an array.  Can you please check it ?  Thanks for your help. -Tom")*

Thanks Xavier for answering fast,
That worked well. I no longer have the message now.
-Tom

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC83NDU1MS1pbnZhbGlkLWFyZ3VtZW50LWZvci1mb3JlYWNoLWNhcnQtcGhwLWxpbmUtMTQ5MT90bXBsPW1hcmtkb3du) or [Create an account](/register) 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.070 seconds

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