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

#   List cart items on all pages

##

- **[shpuser](/forum/user/30542-shpuser "View shpuser's Profile")**
- [![shpuser's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/cat.png)](/forum/user/30542-shpuser "View shpuser's Profile") Topic Author
- [ Offline](/forum/user/30542-shpuser)

Less More

- Posts: 97
- Thank you received: 0
-
-

10 years 3 weeks ago -  10 years 3 weeks ago [\#252708](#252708) by [shpuser](/forum/user/30542-shpuser "View shpuser's Profile")  *[List cart items on all pages](/forum/26-product-category-display/886974-list-cart-items-on-all-pages#252708 "-- HikaShop version -- : 2.6.0  I need on all pages pages this code, this are simple all products in cart:  But on some pages I get this error : Notice: Undefined property: CheckoutViewCheckout::$rows in PATH&#95;TO&#95;TEMPLATE&#92;html&#92;com&#95;hikashop&#92;checkout&#92;step.php on line 207  What do I have to fix there to get always correct cart products?")* was created by *[shpuser](/forum/user/30542-shpuser "View shpuser's Profile")*

-- HikaShop version -- : 2.6.0

I need on all pages pages this code, this are simple all products in cart:
Code:

$this-&gt;setLayout('listing_price'); $k = 0; $group = $this-&gt;config-&gt;get('group_options',0); $defaultParams = $this-&gt;config-&gt;get('default_params'); $productClass = hikashop_get('class.product'); $quantityDisplayType = hikashop_get('type.quantitydisplay'); foreach($this-&gt;rows as $i =&gt; $row){ if(empty($row-&gt;cart_product_quantity)) continue; if($group &amp;&amp; $row-&gt;cart_product_option_parent_id) continue; $productClass-&gt;addAlias($row); ?&gt; { 'name': '&lt;?php echo strip_tags($row-&gt;product_name); ?&gt;', 'id': '&lt;?php echo $row-&gt;product_id; ?&gt;', &lt;?php $this-&gt;row=&amp;$row; $this-&gt;unit=false; ?&gt; 'price': '&lt;?php echo preg_replace('/\s+/', '', strip_tags($this-&gt;loadTemplate())); ?&gt;', 'brand': 'my_brand', 'category': '', 'variant': '-', 'quantity': &lt;?php echo $row-&gt;cart_product_quantity; ?&gt; }&lt;?php if ($row != end($this-&gt;rows)) : ?&gt;,&lt;?php endif; ?&gt; &lt;?php $k = 1-$k; }

But on some pages I get this error : Notice: Undefined property: CheckoutViewCheckout::$rows in PATH_TO_TEMPLATE\html\com_hikashop\checkout\step.php on line 207

What do I have to fix there to get always correct cart products?

Last edit: 10 years 3 weeks ago by [shpuser](/forum/user/30542-shpuser "View shpuser's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS84ODY5NzQtbGlzdC1jYXJ0LWl0ZW1zLW9uLWFsbC1wYWdlcz90bXBsPW1hcmtkb3du) 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: 86540
- Thank you received: 14299
-
-

10 years 3 weeks ago [\#252755](#252755) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[List cart items on all pages](/forum/26-product-category-display/886974-list-cart-items-on-all-pages#252755 "-- HikaShop version -- : 2.6.0  I need on all pages pages this code, this are simple all products in cart:  But on some pages I get this error : Notice: Undefined property: CheckoutViewCheckout::$rows in PATH&#95;TO&#95;TEMPLATE&#92;html&#92;com&#95;hikashop&#92;checkout&#92;step.php on line 207  What do I have to fix there to get always correct cart products?")*

Hi,

That code would only work when $this-&gt;rows is initialized with the listing of products of the cart and that's only the case for some of the views of the checkout.
So you need to check if it's set before and if not, you need to load it yourself like that: Code:

if(!isset($this-&gt;rows)){ $cartClass = hikashop_get('class.cart'); $cart = $cartClass-&gt;loadFullCart(); $this-&gt;rows =&amp; $cart-&gt;products; }

[ www.hikashop.com/support/documentation/6...umentation.html#code](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#code)

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

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