Welcome Guest, Not a member yet? Register   Sign In
Hide item price if user is not logged in
#1

I wanna hide the price from unregistered  and registered users that are not logged in  my code 

I have used the  same syntax  to hide links as below and works perfect
PHP Code:
                    <?php 
                        
if($obj->hasloggedin)
                        {
                            echo 
'<a href="catalogue">CATALOGUES</a>';
                        }
                        else 
                        {
                            echo 
'';                
                        }
                    
?>



but i seem not to get around nesting another if statement  under another if statement.(brings a blank page Undecided )

anyone with an idea to resolve this Confused
PHP Code:
            <?php 
            
if($obj->hasloggedin)
            {
                echo 
'
                <form class="form-horizontal qtyFrm" onsubmit = "addtocartwithquantity($(this).attr('
action')+'/'+$('#qty').val(),this,event);" action = "<?php echo  base_url().'cart/addtocart/'.$obj->product['product_id'];?>">
                  <div class="control-group">
                    <label class="control-label">
                        <?php 
                            
if($obj->product["discount_status"] == "1")
                            {
                                echo 
'
                                    <strong>Price&nbsp;:</strong>&nbsp;<span class = "price-number" style = "text-decoration:line-through;color : red;">R '
.$obj->product["product_price"].'</span><br />
                                    <strong>Discount&nbsp;Price&nbsp;:</strong>&nbsp;<span class = "price-number" style = "">R'
.$obj->product["discount_price"].' </span>
                                '
;
                            }
                            else
                            {
                                echo 
'<strong>Price&nbsp;:</strong>&nbsp;<span class = "price-number">R '.$obj->product["product_price"].'</span>';
                            }
                        
?>
                    </label>
                    <div class="controls" style="clear: both;margin-left: 0px;">
                        <input type="number" id = "qty" class="span1 num_inc" placeholder="Qty."/>
                      <button type="submit" class="btn btn-large btn-success pull-right"> Add to cart <i class=" icon-shopping-cart"></i>
                      </button>
                    </div>                    
                  </div>
                </form>
                ';

                
                echo '<li class="">';
            }
            else 
            {
                echo '<li class="">';                
            }
        ?>
Reply


Messages In This Thread
Hide item price if user is not logged in - by chanceymwa - 07-15-2018, 07:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB