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

#   How to change product quantity logic

##

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

Less More

- Posts: 1195
- Thank you received: 13
-
-

11 years 5 months ago [\#205108](#205108) by [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")  *[How to change product quantity logic](/forum/4-how-to/877596-how-to-change-product-quantity-logic#205108 "Hi! I need your help here with a client. We re building a shop like all others but there is a change in quantity display.  When quantity is from 1 to 5 , I need to show a color with css for example yellow When quantity is from 5 to unlimited , I need to show a color with css for example green. When quantity is 0 , I need to show a color with css for example red.  Is that possible without changing the core of hikashop? Can this be done with a custom field?  Thanks!")* was created by *[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")*

Hi!
I need your help here with a client.
We re building a shop like all others but there is a change in quantity display.

When quantity is from 1 to 5 , I need to show a color with css for example yellow
When quantity is from 5 to unlimited , I need to show a color with css for example green.
When quantity is 0 , I need to show a color with css for example red.

Is that possible without changing the core of hikashop?
Can this be done with a custom field?

Thanks!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg3NzU5Ni1ob3ctdG8tY2hhbmdlLXByb2R1Y3QtcXVhbnRpdHktbG9naWM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) 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)
-

11 years 5 months ago [\#205119](#205119) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[How to change product quantity logic](/forum/4-how-to/877596-how-to-change-product-quantity-logic#205119 "Hi! I need your help here with a client. We re building a shop like all others but there is a change in quantity display.  When quantity is from 1 to 5 , I need to show a color with css for example yellow When quantity is from 5 to unlimited , I need to show a color with css for example green. When quantity is 0 , I need to show a color with css for example red.  Is that possible without changing the core of hikashop? Can this be done with a custom field?  Thanks!")*

Hi,

You will have to do a view override, the view in question is "product / quantity".
So in that view just add a php if/else condition on the product stock and add a div around the content with the desired class.
Then apply a css property on the created classes.

[ www.hikashop.com/support/support/documen...ize-the-display.html](http://www.hikashop.com/support/support/documentation/153-customize-the-display.html)

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

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

Less More

- Posts: 1195
- Thank you received: 13
-
-

11 years 5 months ago [\#205243](#205243) by [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")  Replied by *[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")* on topic *[How to change product quantity logic](/forum/4-how-to/877596-how-to-change-product-quantity-logic#205243 "Hi! I need your help here with a client. We re building a shop like all others but there is a change in quantity display.  When quantity is from 1 to 5 , I need to show a color with css for example yellow When quantity is from 5 to unlimited , I need to show a color with css for example green. When quantity is 0 , I need to show a color with css for example red.  Is that possible without changing the core of hikashop? Can this be done with a custom field?  Thanks!")*

Thank you Xavier.
That is what I suspected I should do form the beginning. Is it possible to write in the forum the php code? An example of it?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg3NzU5Ni1ob3ctdG8tY2hhbmdlLXByb2R1Y3QtcXVhbnRpdHktbG9naWM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) 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)
-

11 years 5 months ago [\#205258](#205258) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[How to change product quantity logic](/forum/4-how-to/877596-how-to-change-product-quantity-logic#205258 "Hi! I need your help here with a client. We re building a shop like all others but there is a change in quantity display.  When quantity is from 1 to 5 , I need to show a color with css for example yellow When quantity is from 5 to unlimited , I need to show a color with css for example green. When quantity is 0 , I need to show a color with css for example red.  Is that possible without changing the core of hikashop? Can this be done with a custom field?  Thanks!")*

Hi,

Please replace the content of the view by: Code:

&lt;?php global $Itemid; $url_itemid = ''; if(!empty($this-&gt;itemid)) $url_itemid = $this-&gt;itemid; elseif(!empty($Itemid)) $url_itemid = '&amp;Itemid='.$Itemid; if($this-&gt;config-&gt;get('show_quantity_field') == -2) $this-&gt;params-&gt;set('show_quantity_field', @$this-&gt;row-&gt;product_display_quantity_field); $config =&amp; hikashop_config(); if($this-&gt;row-&gt;product_quantity &gt; 5 &#124;&#124; $this-&gt;row-&gt;product_quantity == '-1'){ $customClass = 'greentext'; }elseif($this-&gt;row-&gt;product_quantity &gt; 0){ $customClass = 'yellowtext'; }else{ $customClass = 'redtext'; } $wishlistEnabled = $config-&gt;get('enable_wishlist', 1); $hideForGuest = 1; if(($config-&gt;get('hide_wishlist_guest', 1) &amp;&amp; hikashop_loadUser() != null) &#124;&#124; !$config-&gt;get('hide_wishlist_guest', 1)) $hideForGuest = 0; if(!isset($this-&gt;cart)) $this-&gt;cart = hikashop_get('helper.cart'); $url = ''; $module_id = $this-&gt;params-&gt;get('from_module', 0); if(empty($this-&gt;ajax)) $this-&gt;ajax = 'return hikashopModifyQuantity(\''.$this-&gt;row-&gt;product_id.'\',field,1,0,\'cart\','.$module_id.')'; if(@$this-&gt;row-&gt;product_sale_start &#124;&#124; empty($this-&gt;element-&gt;main)) $start_date = @$this-&gt;row-&gt;product_sale_start; else $start_date = $this-&gt;element-&gt;main-&gt;product_sale_start; if(@$this-&gt;row-&gt;product_sale_end &#124;&#124; empty($this-&gt;element-&gt;main)) $end_date = @$this-&gt;row-&gt;product_sale_end; else $end_date = $this-&gt;element-&gt;main-&gt;product_sale_end; $formName = ',0'; if(!$this-&gt;config-&gt;get('ajax_add_to_cart', 0) &#124;&#124; ($this-&gt;config-&gt;get('show_quantity_field') &gt;= 2 &amp;&amp; !@$this-&gt;element-&gt;product_id)) { if(empty($this-&gt;formName)) { if(@$this-&gt;row-&gt;product_id) $formName = ',\'hikashop_product_form_'.$this-&gt;row-&gt;product_id.'_'.$this-&gt;params-&gt;get('main_div_name').'\''; else $formName = ',\'hikashop_product_form_'.$this-&gt;params-&gt;get('main_div_name').'\''; } else { $formName = $this-&gt;formName; } } $showFree = 0; if($this-&gt;config-&gt;get('display_add_to_wishlist_for_free_products', 1) &#124;&#124; (!$this-&gt;config-&gt;get('display_add_to_wishlist_for_free_products', 1) &amp;&amp; $this-&gt;row-&gt;prices[0]-&gt;price_value != '0')){ $showFree = 1; } if($end_date &amp;&amp; $end_date &lt; time()) { ?&gt; &lt;span class="hikashop_product_sale_end"&gt; &lt;?php echo JText::_('ITEM_NOT_SOLD_ANYMORE'); ?&gt; &lt;/span&gt; &lt;?php } elseif($start_date &amp;&amp; $start_date &gt; time()) { ?&gt; &lt;span class="hikashop_product_sale_start"&gt;&lt;?php echo JText::sprintf('ITEM_SOLD_ON_DATE', hikashop_getDate($start_date, $this-&gt;params-&gt;get('date_format','%d %B %Y'))); //TODO echo $this-&gt;cart-&gt;displayButton(JText::_('Pre-order and add to cart'),'add',$this-&gt;params,$url,$ajax); ?&gt;&lt;/span&gt; &lt;?php } elseif(!$this-&gt;params-&gt;get('catalogue') &amp;&amp; ($this-&gt;config-&gt;get('display_add_to_cart_for_free_products') &#124;&#124; !empty($this-&gt;row-&gt;prices))) { if(@$this-&gt;row-&gt;product_min_per_order &#124;&#124; empty($this-&gt;element-&gt;main)) $min = @$this-&gt;row-&gt;product_min_per_order; else $min = @$this-&gt;element-&gt;main-&gt;product_min_per_order; if(@$this-&gt;row-&gt;product_max_per_order &#124;&#124; empty($this-&gt;element-&gt;main)) $max = @$this-&gt;row-&gt;product_max_per_order; else $max = @$this-&gt;element-&gt;main-&gt;product_max_per_order; if($min &lt;= 0) $min = 1; $wishlistAjax = 'if(hikashopCheckChangeForm(\'item\''.$formName.')){ return hikashopModifyQuantity(\'' . (int)@$this-&gt;row-&gt;product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }'; if($this-&gt;row-&gt;product_quantity == -1 &amp;&amp; !empty($this-&gt;element-&gt;main) &amp;&amp; $this-&gt;element-&gt;main-&gt;product_quantity != -1) $this-&gt;row-&gt;product_quantity = $this-&gt;element-&gt;main-&gt;product_quantity; $btnType = 'add'; if($this-&gt;row-&gt;product_quantity == -1) { ?&gt; &lt;div class="hikashop_product_stock"&gt;&lt;?php $text = JText::_('UNLIMITED_STOCK').'&lt;br/&gt;'; echo '&lt;span class="hikashop_product_stock_count '.$customClass.'"&gt;'.$text.'&lt;br/&gt;&lt;/span&gt;'; if(!empty($this-&gt;row-&gt;has_options)) { if($this-&gt;params-&gt;get('add_to_cart',1)) echo $this-&gt;cart-&gt;displayButton(JText::_('CHOOSE_OPTIONS'), 'choose_options', $this-&gt;params, hikashop_contentLink('product&amp;task=show&amp;product_id='.$this-&gt;row-&gt;product_id.'&amp;name='.$this-&gt;row-&gt;alias.$url_itemid.$this-&gt;category_pathway,$this-&gt;row),'window.location = \''.str_replace("'","\'",hikashop_contentLink('product&amp;task=show&amp;product_id='.$this-&gt;row-&gt;product_id.'&amp;name='.$this-&gt;row-&gt;alias.$url_itemid.$this-&gt;category_pathway,$this-&gt;row)).'\';return false;', ''); } else { if($this-&gt;params-&gt;get('add_to_cart',1)) { echo $this-&gt;cart-&gt;displayButton(JText::_('ADD_TO_CART'), 'add', $this-&gt;params,$url, $this-&gt;ajax, '', $max, $min); $btnType = 'wish'; } if(hikashop_level(1) &amp;&amp; $this-&gt;params-&gt;get('add_to_wishlist') &amp;&amp; $wishlistEnabled &amp;&amp; !$hideForGuest &amp;&amp; $showFree) { echo '&lt;div id="hikashop_add_wishlist"&gt;' . $this-&gt;cart-&gt;displayButton(JText::_('ADD_TO_WISHLIST'), $btnType, $this-&gt;params, $url, $wishlistAjax, '', $max, $min, '', false) . '&lt;/div&gt;'; } } } elseif($this-&gt;row-&gt;product_quantity &gt; 0) { ?&gt; &lt;div class="hikashop_product_stock"&gt; &lt;?php if($this-&gt;row-&gt;product_quantity == 1 &amp;&amp; JText::_('X_ITEM_IN_STOCK') != 'X_ITEM_IN_STOCK') $text = JText::sprintf('X_ITEM_IN_STOCK', $this-&gt;row-&gt;product_quantity); else $text = JText::sprintf('X_ITEMS_IN_STOCK', $this-&gt;row-&gt;product_quantity); echo '&lt;span class="hikashop_product_stock_count '.$customClass.'"&gt;'.$text.'&lt;br/&gt;&lt;/span&gt;'; if($config-&gt;get('button_style', 'normal') == 'css') echo '&lt;br /&gt;'; if($max &lt;= 0 &#124;&#124; $max &gt; $this-&gt;row-&gt;product_quantity) $max = $this-&gt;row-&gt;product_quantity; if(!empty($this-&gt;row-&gt;has_options)) { if($this-&gt;params-&gt;get('add_to_cart', 1)) echo $this-&gt;cart-&gt;displayButton(JText::_('CHOOSE_OPTIONS'), 'choose_options', $this-&gt;params, hikashop_contentLink('product&amp;task=show&amp;product_id='.$this-&gt;row-&gt;product_id.'&amp;name='.$this-&gt;row-&gt;alias.$url_itemid.$this-&gt;category_pathway,$this-&gt;row),'window.location = \''.str_replace("'","\'",hikashop_contentLink('product&amp;task=show&amp;product_id='.$this-&gt;row-&gt;product_id.'&amp;name='.$this-&gt;row-&gt;alias.$url_itemid.$this-&gt;category_pathway,$this-&gt;row)).'\';return false;',''); } else { if($this-&gt;params-&gt;get('add_to_cart', 1)) { echo $this-&gt;cart-&gt;displayButton(JText::_('ADD_TO_CART'), 'add', $this-&gt;params, $url, $this-&gt;ajax, '', $max, $min); $btnType = 'wish'; } if(hikashop_level(1) &amp;&amp; $this-&gt;params-&gt;get('add_to_wishlist') &amp;&amp; $wishlistEnabled &amp;&amp; !$hideForGuest &amp;&amp; $showFree){ echo '&lt;div id="hikashop_add_wishlist"&gt;' . $this-&gt;cart-&gt;displayButton(JText::_('ADD_TO_WISHLIST'), $btnType, $this-&gt;params, $url, $wishlistAjax, '', $max, $min, '', false) . '&lt;/div&gt;'; } } } else { ?&gt; &lt;div class="hikashop_product_no_stock"&gt; &lt;?php $text = JText::_('NO_STOCK').'&lt;br/&gt;'; echo '&lt;span class="hikashop_product_stock_count '.$customClass.'"&gt;'.$text.'&lt;br/&gt;&lt;/span&gt;'; $waitlist = $this-&gt;config-&gt;get('product_waitlist', 0); if(hikashop_level(1) &amp;&amp; ($waitlist == 2 &#124;&#124; ($waitlist == 1 &amp;&amp; (!empty($this-&gt;row-&gt;main-&gt;product_waitlist) &#124;&#124; !empty($this-&gt;row-&gt;product_waitlist))))) { ?&gt; &lt;/div&gt; &lt;div id="hikashop_product_waitlist_main" class="hikashop_product_waitlist_main"&gt; &lt;?php $empty = ''; jimport('joomla.html.parameter'); $params = new HikaParameter($empty); echo $this-&gt;cart-&gt;displayButton(JText::_('ADD_ME_WAITLIST'), 'add_waitlist', $params, hikashop_completeLink('product&amp;task=waitlist&amp;cid='.$this-&gt;row-&gt;product_id.$url_itemid), 'window.location=\''.str_replace("'","\'",hikashop_completeLink('product&amp;task=waitlist&amp;cid='.$this-&gt;row-&gt;product_id.$url_itemid)).'\';return false;'); } if(hikashop_level(1) &amp;&amp; $this-&gt;params-&gt;get('add_to_wishlist') &amp;&amp; $wishlistEnabled &amp;&amp; !$hideForGuest &amp;&amp; $showFree) { if(!empty($this-&gt;row-&gt;has_options)) { if($this-&gt;params-&gt;get('add_to_cart', 1)) echo $this-&gt;cart-&gt;displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this-&gt;params,hikashop_contentLink('product&amp;task=show&amp;product_id='.$this-&gt;row-&gt;product_id.'&amp;name='.$this-&gt;row-&gt;alias.$url_itemid.$this-&gt;category_pathway,$this-&gt;row),'window.location = \''.str_replace("'","\'",hikashop_contentLink('product&amp;task=show&amp;product_id='.$this-&gt;row-&gt;product_id.'&amp;name='.$this-&gt;row-&gt;alias.$url_itemid.$this-&gt;category_pathway,$this-&gt;row)).'\';return false;',''); }else{ echo '&lt;div id="hikashop_add_wishlist"&gt;' . $this-&gt;cart-&gt;displayButton(JText::_('ADD_TO_WISHLIST'), 'add', $this-&gt;params, $url, $wishlistAjax, '', @$this-&gt;row-&gt;product_max_per_order, 1, '', false) . '&lt;/div&gt;'; } } } ?&gt; &lt;/div&gt; &lt;?php } elseif(hikashop_level(1) &amp;&amp; $wishlistEnabled &amp;&amp; $this-&gt;params-&gt;get('add_to_wishlist', 1) &amp;&amp; $showFree &amp;&amp; !$hideForGuest &amp;&amp; !$this-&gt;config-&gt;get('display_add_to_cart_for_free_products')) { if(!empty($this-&gt;row-&gt;has_options)) { if($this-&gt;params-&gt;get('add_to_cart', 1)) echo $this-&gt;cart-&gt;displayButton(JText::_('CHOOSE_OPTIONS'), 'choose_options', $this-&gt;params, hikashop_contentLink('product&amp;task=show&amp;product_id='.$this-&gt;row-&gt;product_id.'&amp;name='.$this-&gt;row-&gt;alias.$url_itemid.$this-&gt;category_pathway,$this-&gt;row),'window.location = \''.str_replace("'","\'",hikashop_contentLink('product&amp;task=show&amp;product_id='.$this-&gt;row-&gt;product_id.'&amp;name='.$this-&gt;row-&gt;alias.$url_itemid.$this-&gt;category_pathway,$this-&gt;row)).'\';return false;', ''); } else { $wishlistAjax = 'if(hikashopCheckChangeForm(\'item\''.$formName.')){ return hikashopModifyQuantity(\'' . (int)@$this-&gt;row-&gt;product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }'; echo '&lt;div id="hikashop_add_wishlist"&gt;' . $this-&gt;cart-&gt;displayButton(JText::_('ADD_TO_WISHLIST'), 'add', $this-&gt;params, $url, $wishlistAjax, '', @$this-&gt;row-&gt;product_max_per_order, 1, '', false) . '&lt;/div&gt;'; } } ?&gt;

You will have to add a translation override on the key "UNLIMITED_STOCK" something like:

> UNLIMITED\_STOCK="Unlimited quantity"

The PHP if condition used to check the quantity given in the previous code is: Code:

if($this-&gt;row-&gt;product_quantity &gt; 5 &#124;&#124; $this-&gt;row-&gt;product_quantity == '-1'){ $customClass = 'greentext'; }elseif($this-&gt;row-&gt;product_quantity &gt; 0){ $customClass = 'yellowtext'; }else{ $customClass = 'redtext'; }

So you can apply your css properties on the classes "greentext" "yellowtext" and "redtext".

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

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

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

Less More

- Posts: 1195
- Thank you received: 13
-
-

11 years 5 months ago [\#205854](#205854) by [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")  Replied by *[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")* on topic *[How to change product quantity logic](/forum/4-how-to/877596-how-to-change-product-quantity-logic#205854 "Hi! I need your help here with a client. We re building a shop like all others but there is a change in quantity display.  When quantity is from 1 to 5 , I need to show a color with css for example yellow When quantity is from 5 to unlimited , I need to show a color with css for example green. When quantity is 0 , I need to show a color with css for example red.  Is that possible without changing the core of hikashop? Can this be done with a custom field?  Thanks!")*

Thank you very much Xavier!
Can you please tell me how to NOT display the quantity now. Because I want the color to replace the logic of the real stock.

Thanks!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg3NzU5Ni1ob3ctdG8tY2hhbmdlLXByb2R1Y3QtcXVhbnRpdHktbG9naWM/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
-
-
-

11 years 5 months ago [\#205874](#205874) 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 *[How to change product quantity logic](/forum/4-how-to/877596-how-to-change-product-quantity-logic#205874 "Hi! I need your help here with a client. We re building a shop like all others but there is a change in quantity display.  When quantity is from 1 to 5 , I need to show a color with css for example yellow When quantity is from 5 to unlimited , I need to show a color with css for example green. When quantity is 0 , I need to show a color with css for example red.  Is that possible without changing the core of hikashop? Can this be done with a custom field?  Thanks!")*

Hello,
You'll just have to use a custom CSS class regarding the case, and use the "display: none;" CSS property to hide it.

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

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

Less More

- Posts: 1195
- Thank you received: 13
-
-

11 years 5 months ago [\#206057](#206057) by [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")  Replied by *[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")* on topic *[How to change product quantity logic](/forum/4-how-to/877596-how-to-change-product-quantity-logic#206057 "Hi! I need your help here with a client. We re building a shop like all others but there is a change in quantity display.  When quantity is from 1 to 5 , I need to show a color with css for example yellow When quantity is from 5 to unlimited , I need to show a color with css for example green. When quantity is 0 , I need to show a color with css for example red.  Is that possible without changing the core of hikashop? Can this be done with a custom field?  Thanks!")*

Mohamed I believe I can t use the display:none, because I use the $customClass = 'yellowtext'; which comes to my css like

&lt;span class="hikashop_product_stock_count yellowtext"&gt;3 κομμάτια στο απόθεμα&lt;br&gt;&lt;/span&gt;

I user in my css file
span.hikashop_product_stock_count.yellowtext {
display: block;
color: yellow;
padding: 2px;
background-color: black;

So if i use
display:none,
the whole class will be vanished

There is no seperated class for the quantity text

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg3NzU5Ni1ob3ctdG8tY2hhbmdlLXByb2R1Y3QtcXVhbnRpdHktbG9naWM/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) 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)
-

11 years 5 months ago [\#206209](#206209) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[How to change product quantity logic](/forum/4-how-to/877596-how-to-change-product-quantity-logic#206209 "Hi! I need your help here with a client. We re building a shop like all others but there is a change in quantity display.  When quantity is from 1 to 5 , I need to show a color with css for example yellow When quantity is from 5 to unlimited , I need to show a color with css for example green. When quantity is 0 , I need to show a color with css for example red.  Is that possible without changing the core of hikashop? Can this be done with a custom field?  Thanks!")*

Hi,

To not display the quantity you can edit the code and remove the $text between the html "span" tags.

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

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

Less More

- Posts: 1195
- Thank you received: 13
-
-

11 years 5 months ago [\#206243](#206243) by [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")  Replied by *[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")* on topic *[How to change product quantity logic](/forum/4-how-to/877596-how-to-change-product-quantity-logic#206243 "Hi! I need your help here with a client. We re building a shop like all others but there is a change in quantity display.  When quantity is from 1 to 5 , I need to show a color with css for example yellow When quantity is from 5 to unlimited , I need to show a color with css for example green. When quantity is 0 , I need to show a color with css for example red.  Is that possible without changing the core of hikashop? Can this be done with a custom field?  Thanks!")*

Please Xavier can you tell me the file I have to edit ? is it the quantity page again?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg3NzU5Ni1ob3ctdG8tY2hhbmdlLXByb2R1Y3QtcXVhbnRpdHktbG9naWM/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: 86587
- Thank you received: 14325
-
-

11 years 5 months ago [\#206244](#206244) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to change product quantity logic](/forum/4-how-to/877596-how-to-change-product-quantity-logic#206244 "Hi! I need your help here with a client. We re building a shop like all others but there is a change in quantity display.  When quantity is from 1 to 5 , I need to show a color with css for example yellow When quantity is from 5 to unlimited , I need to show a color with css for example green. When quantity is 0 , I need to show a color with css for example red.  Is that possible without changing the core of hikashop? Can this be done with a custom field?  Thanks!")*

He was talking about this line in the same file:
echo '&lt;span class="hikashop_product_stock_count '.$customClass.'"&gt;'.$text.'&lt;br/&gt;&lt;/span&gt;';
You can remove it to remove the quantity display.

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

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