Hi,
The easiest way is to use the contact button instead of the add to cart button in Configuration > Display, select "For all products" for the option "Display a contact button on the product page" and "No" for the option "Display 'add to cart' button".
Then edit the view "product / show_default" in HikaShop > Display > Views.
Replace the lines:
<?php
$contact = $this->config->get('product_contact',0);
if (hikashop_level(1) && $this->row->product_quantity == 0 || ($contact == 2 || ($contact == 1 && !empty ($this->element->product_contact)))) {
$empty = '';
$params = new HikaParameter($empty);
echo $this->cart->displayButton(JText :: _('CONTACT_US_FOR_INFO'), 'contact_us', $params, hikashop_completeLink('product&task=contact&cid=' . $this->row->product_id), 'window.location=\'' . hikashop_completeLink('product&task=contact&cid=' . $this->row->product_id) . '\';return false;');
}
?>
By:
<?php
$contact = $this->config->get('product_contact',0);
if (hikashop_level(1) && $this->row->product_quantity == 0 || ($contact == 2 || ($contact == 1 && !empty ($this->element->product_contact)))) {
$empty = '';
$params = new HikaParameter($empty);
echo $this->cart->displayButton(JText :: _('ADD_TO_CART'), 'contact_us', $params, hikashop_completeLink('product&task=contact&cid=' . $this->row->product_id), 'window.location=\'' . hikashop_completeLink('product&task=contact&cid=' . $this->row->product_id) . '\';return false;','',0,1,'redButton');
}
?>
And in the view "product / quantity", replace:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min);
By:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min,'greenButton');
Where the if condition is: "if($this->row->product_quantity==-1){"
And where the if condition is: "}elseif($this->row->product_quantity>0){" add the following code:
if($this->row->product_quantity > 10){$btnClass = 'greenButton';}
elseif($this->row->product_quantity <= 10){$btnClass = 'yellowButton';}
And replace the line:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min);
By:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min,$btnClass);
Then you have to create the properties for the new classes in HikaShop > Configuration > Display "Front-end default CSS" file.
Like:
.greenButton{
background-color: green;
...
}
Ps: you need the essential version for doing this.