Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Currency box disable


Peper

Recommended Posts

I'm trying to display the currency box only for customers who is logged in and from another country only

 

So I came up with this part but not entirely even close

 

Box not to display if user is not logged in and then also not to show up if country ID is 183, default currency is ZAR

Please show me how to

<?php if($check_country['entry_country_id'] == 183) {
 		  $currency = 'ZAR';		
		} else {
?>
<div class="panel panel-default">
  <div class="panel-heading"><?php echo MODULE_BOXES_CURRENCIES_BOX_TITLE; ?></div>
  <div class="panel-body"><?php echo $form_output; ?></div>
</div>
<?php 
}
?>

Getting the Phoenix off the ground

Link to comment
Share on other sites

Hello Pierre @@Peper,

 

I would say it is better to do this over the "isEnabled" function in the box module "bm_currencies.php"

 

should be something like this:

    function isEnabled() {    	
      global $customer_id, $my_customer_country_id_variable;
    	if ( tep_session_is_registered('customer_id') && $my_customer_country_id_variable == 183 ) {   
                $this->enabled = false;
    	} else {
    		return $this->enabled;
    	}
    }

I do not know where from you got this: "$check_country['entry_country_id']"

To check the country you would need to do a database query to retrieve the customers country from the customers default address in the address book table and then check it.

The currency setting should be done in application_top.php. You may also do the country check in application_top.php and pass the customer country by an own variable to the box module. Don't forget to add it in the globals list then.

 

rgds

Rainer

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...