News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Assign user who should receive query email and invoice mail

Started by abugroup, October 12, 2012, 14:26:35 PM

Previous topic - Next topic

abugroup

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



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



<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


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]