$already = false;
foreach($this->rows as $i => $row){
if($row->product_code =='Transfer_Number_Fee') $already = true;
}
if($this->order->numberchoice=='newnumber'){
if(!$already){
$app =& JFactory::getApplication();
$app->redirect(hikashop::completeLink('product&task=updatecart&product_id=9&quantity=1&add=0&return='.urlencode(base64_encode(hikashop::currentUrl()))));
}
}else{
if($already){
$app =& JFactory::getApplication();
$app->redirect(hikashop::completeLink('product&task=updatecart&product_id=9&quantity=0&add=1&return='.urlencode(base64_encode(hikashop::currentUrl()))));
}
}
i don't think this is going to give me the result i want. the code says if they select they want a new number and there isn't a transfer fee there it will add one. I want the transfer fee to come up when they select that they want to keep their number, so it would be 'keepnumber' instead of 'newnumber'. also based on the code you sent me wouldn't it get stuck in a loop? adding and removing the product? if the selection was left on 'newnumber'.
so over all what we want is that if the selection is 'keepnumber' to add the transfer fee to the cart, and if they select 'newnumber' it gets removed. That is why i thought this might work.
$already = false;
foreach($this->rows as $i => $row){
if($row->product_code =='Transfer_Number_Fee') $already = true;
}
if($this->order->numberchoice=='keepnumber'){
if(!$already){
$app =& JFactory::getApplication();
$app->redirect(hikashop::completeLink('product&task=updatecart&product_id=9&quantity=1&add=0&return='.urlencode(base64_encode(hikashop::currentUrl()))));
}
}else{
if($this->order->numberchoice=='newnumber'){
$app =& JFactory::getApplication();
$app->redirect(hikashop::completeLink('product&task=updatecart&product_id=9&quantity=0&add=1&return='.urlencode(base64_encode(hikashop::currentUrl()))));
}
it's not doing anything at the moment. just thought it might need some tweaking to make it work. also since this on the custom field part should i add the code there or in the cart view? also since it's in the custom fields part should we add the a check for the user selection like we had in the code for the custom fields?