Apply tax value to total if a value is set in the database - Joomla! Forum - community, help and support


hello,

i trying figure out how modify code snippet can pull gstexempt value #__kiduka_accounts table, check if set 0 or 1 , apply tax value accordingly.

code: select all

$db = jfactory::getdbo();
       $query = 'select a.id, a.gstexempt #__users u
          left join #__kiduka_accounts on u.id = a.user_id
          where u.gid < 23';
       if(jrequest::getint('membertype', 0) > 0)
       {
          $query .= ' , a.membertype = '.jrequest::getint('membertype', 0);
       }
       $db->setquery($query);
       $users = $db->loadresultarray();
       $query = 'select * #__kiduka_products id = '.jrequest::getvar('purchaseproduct');
       $db->setquery($query);
       $product   = $db->loadobject();
       $params    = jcomponenthelper::getparams('com_kiduka');
       $tax       = $params->get('tax');
       $gstexempt = $users->gstexempt;
       
       if ($gstexempt != 1) {
       
          $subtotal   = $product->price;
          $taxtotal   = $subtotal * $tax / 100;
          $finaltotal = $taxtotal + $subtotal;
          
       } else {
          
          $subtotal   = $product->price;
          $taxtotal   = "0.00";
          $finaltotal = $subtotal;
          
       }

can share insight on need change make work?

thank you.

mike
joomla 1.5






Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support