The code you sent works PERFECTLY! I am having a small issue with the Step number. Before the changes you sent me, the area of step.php I am changing looked like this:
if($this->step==3){
echo $this->cart->displayButton(JText::_('PLACE_ORDER_BUTTON'),'next',$this->params,hikashop::completeLink('checkout&task=step&step='.$this->step+1),'document.forms[\'hikashop_checkout_form\'].submit(); return false; ','id="hikashop_checkout_next_button"');
}else{
echo $this->cart->displayButton(JText::_('NEXT'),'next',$this->params,hikashop::completeLink('checkout&task=step&step='.$this->step+1),'document.forms[\'hikashop_checkout_form\'].submit(); return false;','id="hikashop_checkout_next_button"');
}
if($this->step!=0){
echo $this->cart->displayButton(JText::_('Back'),'back',$this->params,hikashop::currentUrl(),'history.back();return false;','id="hikashop_checkout_next_button"');
}
I had it like that so that it would display a BACK button on all steps except the first (#0), and the NEXT button would be replaced with PLACE ORDER in the last step (#3).
I changed this section of code to:
if($this->step=0){
$ids=array();
foreach($this->rows as $i => $row){
$ids[]=(int)$row->product_id;
}
$db =& JFactory::getDBO();
$db->setQuery('SELECT category_id FROM '.hikashop::table('product_category').' WHERE product_id IN ('.implode(',',$ids).') AND category_id=24');
$result = $db->loadResult();
if(!empty($result)){
if($this->step==3){
echo $this->cart->displayButton(JText::_('PLACE_ORDER_BUTTON'),'next',$this->params,hikashop::completeLink('checkout&task=step&step='.$this->step+1),'document.forms[\'hikashop_checkout_form\'].submit(); return false; ','id="hikashop_checkout_next_button"');
}else{
echo $this->cart->displayButton(JText::_('NEXT'),'next',$this->params,hikashop::completeLink('checkout&task=step&step='.$this->step+1),'document.forms[\'hikashop_checkout_form\'].submit(); return false;','id="hikashop_checkout_next_button"');
}
if($this->step!=1){
echo $this->cart->displayButton(JText::_('Back'),'back',$this->params,hikashop::currentUrl(),'history.back();return false;','id="hikashop_checkout_next_button"');
}
}else{
echo '<div style="float: right; text-align: right; color: #ff0000; font-weight: bold;">'.JText::_('REQD_CAT_MISSING','Cart must include a Paper Stock').'</div>';
}
}
I have the first IF looking to see if the checkout step is the first (#0). However, nothing displays at the bottom of the page in this case. Not the NEXT button or the text I want to display. If I change the first IF to:
then it displays correctly on the first step in the checkout process, and works absolutely correctly. However, clicking NEXT causes an error on the nest step, because it is evaluating the IF statement again as step #1. It's like I somehow messed with the step numbers. Any idea why?