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

#   Stock display on product listing

##

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

Less More

- Posts: 72
- Thank you received: 4
-
-

13 years 11 months ago [\#76663](#76663) by [Batas](/forum/user/9486-batas "View Batas's Profile")  *[Stock display on product listing](/forum/2-general-talk-about-hikashop/75825-stock-display-on-product-listing#76663 "Hi,  is it possible to get STOCK displaying away from product listing but leave it on product page? Thanx!")* was created by *[Batas](/forum/user/9486-batas "View Batas's Profile")*

Hi,

is it possible to get STOCK displaying away from product listing but leave it on product page?
Thanx!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc1ODI1LXN0b2NrLWRpc3BsYXktb24tcHJvZHVjdC1saXN0aW5nP3RtcGw9bWFya2Rvd24=) 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: 26400
- Thank you received: 4080
-
- [](http://obsi.dev)
-

13 years 11 months ago -  13 years 11 months ago [\#76835](#76835) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Stock display on product listing](/forum/2-general-talk-about-hikashop/75825-stock-display-on-product-listing#76835 "Hi,  is it possible to get STOCK displaying away from product listing but leave it on product page? Thanx!")*

Hi,

You can edit the view "product show" and add find this code at the beginning of the file Code:

if (empty ($this-&gt;element)) { $app-&gt;enqueueMessage(JText::_('PRODUCT_NOT_FOUND'); } else {

And add one line just after, like that: Code:

if (empty ($this-&gt;element)) { $app-&gt;enqueueMessage(JText::_('PRODUCT_NOT_FOUND'); } else { $this-&gt;element-&gt;product_quantity = -1;

At this moment, the quantity would be a fake "unlimited" so the stock block won't be displayed.
But there is a side effect : the javascript script which alert the user for the stock won't be added in the page.

Regards,

---

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

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

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

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

Less More

- Posts: 72
- Thank you received: 4
-
-

13 years 11 months ago [\#76914](#76914) by [Batas](/forum/user/9486-batas "View Batas's Profile")  Replied by *[Batas](/forum/user/9486-batas "View Batas's Profile")* on topic *[Stock display on product listing](/forum/2-general-talk-about-hikashop/75825-stock-display-on-product-listing#76914 "Hi,  is it possible to get STOCK displaying away from product listing but leave it on product page? Thanx!")*

thank you for respons!

I did as you said and got rid of stock on product page. On product listing displays stock as it was before.

I'm sorry to say that, but my wish is vice versa - out from product listing, leave it on product page ![:)](/media/kunena/emoticons/3.png ":)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc1ODI1LXN0b2NrLWRpc3BsYXktb24tcHJvZHVjdC1saXN0aW5nP3RtcGw9bWFya2Rvd24=) 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: 26400
- Thank you received: 4080
-
- [](http://obsi.dev)
-

13 years 11 months ago -  13 years 11 months ago [\#76981](#76981) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Stock display on product listing](/forum/2-general-talk-about-hikashop/75825-stock-display-on-product-listing#76981 "Hi,  is it possible to get STOCK displaying away from product listing but leave it on product page? Thanx!")*

Hi,

Oh sorry, it was the inverse. I misunderstood your request !
Well, the modification is the same but for another file.
First, revert your modification in the "product show" view.
Edit the "product listing" view and add this code. Code:

if(!empty($this-&gt;rows)) { foreach($this-&gt;rows as &amp;$row){ $row-&gt;product_quantity = -1; } unset($row); }

It would modify the quantity for every product in the current list.

Regards,

---

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

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

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

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

Less More

- Posts: 72
- Thank you received: 4
-
-

13 years 11 months ago [\#77044](#77044) by [Batas](/forum/user/9486-batas "View Batas's Profile")  Replied by *[Batas](/forum/user/9486-batas "View Batas's Profile")* on topic *[Stock display on product listing](/forum/2-general-talk-about-hikashop/75825-stock-display-on-product-listing#77044 "Hi,  is it possible to get STOCK displaying away from product listing but leave it on product page? Thanx!")*

![:)](/media/kunena/emoticons/3.png ":)")

but as beeing amateur I'm not sure where to place this code within file.
I tried to place at many places inside the file but every time I got only broken page... :blush:

can you please advise?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc1ODI1LXN0b2NrLWRpc3BsYXktb24tcHJvZHVjdC1saXN0aW5nP3RtcGw9bWFya2Rvd24=) 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: 26400
- Thank you received: 4080
-
- [](http://obsi.dev)
-

13 years 11 months ago -  13 years 11 months ago [\#77109](#77109) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Stock display on product listing](/forum/2-general-talk-about-hikashop/75825-stock-display-on-product-listing#77109 "Hi,  is it possible to get STOCK displaying away from product listing but leave it on product page? Thanx!")*

Hi,

You should have at the beginning of the file Code:

&lt;?php if(hikashop_level(2) &amp;&amp; JRequest::getVar('hikashop_front_end_main',0) &amp;&amp; JRequest::getVar('task')=='listing' &amp;&amp; $this-&gt;params-&gt;get('show_compare')) {?&gt;

You can put the PHP code there Code:

&lt;?php if(!empty($this-&gt;rows)) { foreach($this-&gt;rows as &amp;$row){ $row-&gt;product_quantity = -1; } unset($row); } if(hikashop_level(2) &amp;&amp; JRequest::getVar('hikashop_front_end_main',0) &amp;&amp; JRequest::getVar('task')=='listing' &amp;&amp; $this-&gt;params-&gt;get('show_compare')) {?&gt;

Regards,

---

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

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

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

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

Less More

- Posts: 72
- Thank you received: 4
-
-

13 years 11 months ago [\#77131](#77131) by [Batas](/forum/user/9486-batas "View Batas's Profile")  Replied by *[Batas](/forum/user/9486-batas "View Batas's Profile")* on topic *[Stock display on product listing](/forum/2-general-talk-about-hikashop/75825-stock-display-on-product-listing#77131 "Hi,  is it possible to get STOCK displaying away from product listing but leave it on product page? Thanx!")*

hmmm, it looks slightly different. The proposed code was placed rigth down here where HERE is written. Unfortunately broken page afterwards.

&lt;?php

**HERE**

/**
* @package HikaShop for Joomla!
* @version 2.0.0
* @author hikashop.com
* @copyright (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 [ www.gnu.org/licenses/gpl-3.0.html](http://www.gnu.org/licenses/gpl-3.0.html)
*/

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

**HERE**

if(hikashop_level(2) &amp;&amp; JRequest::getVar('hikashop_front_end_main',0) &amp;&amp; JRequest::getVar('task')=='listing' &amp;&amp; $this-&gt;params-&gt;get('show_compare')) {?&gt;

**HERE**

&lt;script type="text/javascript"&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc1ODI1LXN0b2NrLWRpc3BsYXktb24tcHJvZHVjdC1saXN0aW5nP3RtcGw9bWFya2Rvd24=) 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: 26400
- Thank you received: 4080
-
- [](http://obsi.dev)
-

13 years 11 months ago [\#77136](#77136) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Stock display on product listing](/forum/2-general-talk-about-hikashop/75825-stock-display-on-product-listing#77136 "Hi,  is it possible to get STOCK displaying away from product listing but leave it on product page? Thanx!")*

Hi,

The second one:
?&gt;&lt;?php

**HERE**

if(hikashop_level(2) &amp;&amp; JRequest::getVar('hikashop_front_end_main',0) &amp;&amp; JRequest::getVar('task')=='listing' &amp;&amp; $this-&gt;params-&gt;get('show_compare')) {?&gt;

Best regards,

---

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

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

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

Less More

- Posts: 72
- Thank you received: 4
-
-

13 years 11 months ago [\#77138](#77138) by [Batas](/forum/user/9486-batas "View Batas's Profile")  Replied by *[Batas](/forum/user/9486-batas "View Batas's Profile")* on topic *[Stock display on product listing](/forum/2-general-talk-about-hikashop/75825-stock-display-on-product-listing#77138 "Hi,  is it possible to get STOCK displaying away from product listing but leave it on product page? Thanx!")*

with that code:

?&gt;&lt;?php

if(!empty($this-&gt;rows) {
foreach($this-&gt;rows as &amp;$row){
$row-&gt;product_quantity = -1;
}
unset($row);
}
if(hikashop_level(2) &amp;&amp; JRequest::getVar('hikashop_front_end_main',0) &amp;&amp; JRequest::getVar('task')=='listing' &amp;&amp; $this-&gt;params-&gt;get('show_compare')) {?&gt;

I got:

Parse error: syntax error, unexpected '{' in /home/greenros/public_html/templates/bt_bazaar/html/com_hikashop/product/listing.php on line 13

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzc1ODI1LXN0b2NrLWRpc3BsYXktb24tcHJvZHVjdC1saXN0aW5nP3RtcGw9bWFya2Rvd24=) 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: 26400
- Thank you received: 4080
-
- [](http://obsi.dev)
-

13 years 11 months ago [\#77146](#77146) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Stock display on product listing](/forum/2-general-talk-about-hikashop/75825-stock-display-on-product-listing#77146 "Hi,  is it possible to get STOCK displaying away from product listing but leave it on product page? Thanx!")*

Sorry, my fault !

There was a missing parentheses:
if(!empty($this-&gt;rows)**)** {

Regards,

---

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

The following user(s) said Thank You: [Batas](/forum/user/9486-batas "View Batas's Profile")

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

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

Less More

- Posts: 72
- Thank you received: 4
-
-

13 years 11 months ago [\#77147](#77147) by [Batas](/forum/user/9486-batas "View Batas's Profile")  Replied by *[Batas](/forum/user/9486-batas "View Batas's Profile")* on topic *[Stock display on product listing](/forum/2-general-talk-about-hikashop/75825-stock-display-on-product-listing#77147 "Hi,  is it possible to get STOCK displaying away from product listing but leave it on product page? Thanx!")*

brilliant support! ![:)](/media/kunena/emoticons/3.png ":)")

thanks a lot!

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

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