VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: abugroup on October 12, 2012, 14:26:35 PM

Title: Assign user who should receive query email and invoice mail
Post by: abugroup on October 12, 2012, 14:26:35 PM
I'm Not an expert programer in VM2 but My policy is I can do it

Here I post a coding about how to assign which user should receive product query and who should receive invoice bill

go to --> components\com_virtuemart\helpers\shopfunctionsf.php
and to line 274 or see the below image to locate
shopfunctionsf.jpg
(http://abudeveloper.demo.zudioz.com/vm/shopfunctionsf.jpg)


add following code as in the image
**************************************
$db = JFactory::getDBO();
      
      if(strstr($subject, 'Mr')==true){
      $query = "SELECT * FROM `#__users` where `bill`=1";
      $db->setQuery($query);
      $datas=$db->loadObjectList();
      $abu=0;
      foreach($datas as $row){
         if($abu==0){
         $recipient=$row->email;
         $abu++;
         }
         elseif($abu!=0){
            $recipient=$recipient.', '.$row->email;
         }
      }
      }
      
      
      $finded =strstr($subject, 'About',true);
      if($finded=="Question "){
         
      $recipient="";
      $query = "SELECT * FROM `#__users` where `query`=1";
      $db->setQuery($query);
      $datas=$db->loadObjectList();
      $abu=0;
      foreach($datas as $row){
         if($abu==0){
         $recipient=$row->email;
         $abu++;
         }
         elseif($abu!=0){
            $recipient=$recipient.', '.$row->email;
         }
      }
      }
******************************************************



then go to --> administrator\components\com_users\models\forms\user.xml
paste following code to display like this

(http://abudeveloper.demo.zudioz.com/vm/user.jpg)

<field
            name="query"
            type="radio"
            default="0"
            label="Allow Query Email:"
            description="If check yes then this user can receive Product Query Email">
            <option
               value="0">JNO</option>
            <option
               value="1">JYES</option>
      </field>
      <field
            name="bill"
            type="radio"
            default="0"
            label="Allow Billing Email:"
            description="If check yes then this user can receive Shop billing Email">
            <option
               value="0">JNO</option>
            <option
               value="1">JYES</option>
      </field>
then it looks like this condition.jpg
(http://abudeveloper.demo.zudioz.com/vm/condition.jpg)

then go to your database and then go to #_user

Here you should add two table named as "query" and "bill" as you indicated in user.xml file

Finish here after you can decide who should receive only product query / Invoice mail / both

For your more information I attached that two files

Note: Do this code at your own risk do replace your vm files by my files


If you have any other doubt please post here Once again

"I'm Not an expert programer in VM2 but My policy is I can do it"






[attachment cleanup by admin]