Beispiel #1
0
 function SendMailToAdminApproval($prod_values, $item_id, $newProduct = 1)
 {
     $loguser = JFactory::getUser();
     $comquick2cartHelper = new comquick2cartHelper();
     $app = JFactory::getApplication();
     $mailfrom = $app->getCfg('mailfrom');
     $fromname = $app->getCfg('fromname');
     $sitename = $app->getCfg('sitename');
     $params = JComponentHelper::getParams('com_quick2cart');
     $sendto = $params->get('sale_mail');
     $currency = $comquick2cartHelper->getCurrencySession();
     //$params->get('addcurrency');  // @sheha : currency should take from session instead of param
     //$sendto = $mailfrom;
     $multiple_img = array();
     $count = 0;
     $prod_imgs = $prod_values->get('qtc_prodImg', array(), "ARRAY");
     $quick2cartModelProduct = new quick2cartModelProduct();
     $multiple_img = $quick2cartModelProduct->getProdutImages($item_id);
     $body = '';
     // Edit product
     if ($newProduct == 0) {
         $subject = JText::_('COM_Q2C_EDIT_PRODUCT_SUBJECT');
         $subject = str_replace('{sellername}', $loguser->name, $subject);
         $body = JText::_('COM_Q2C_EDIT_PRODUCT_BODY');
         $body = str_replace('{productname}', $prod_values->get('item_name', '', 'RAW'), $body);
         $pod_price = $prod_values->get('multi_cur', array(), "ARRAY");
         $body = str_replace('{price}', $pod_price[$currency], $body);
         $body = str_replace('{sellername}', $loguser->name, $body);
         $body = str_replace('{sku}', $prod_values->get('sku', '', 'RAW'), $body);
         //~ for($i=0; $i < count($multiple_img); $i++)
         //~ {
         //~ print"<pre>"; print_r($multiple_img); die("222882");
         //~ $body	.= '<br><img src="' . JUri::root() . 'images/quick2cart/' . $multiple_img[$i] . '" alt="No image" ><br>';
         //~ }
         if (!empty($multiple_img)) {
             $multiple_img = (array) $multiple_img;
             foreach ($multiple_img as $key => $img) {
                 $body .= '<br><img src="' . JUri::root() . 'images/quick2cart/' . $img[$key] . '" alt="No image" ><br>';
             }
         }
     } else {
         $subject = JText::_('COM_Q2C_PRODUCT_AAPROVAL_SUBJECT');
         $body = JText::_('COM_Q2C_PRODUCT_AAPROVAL_BODY');
         $body = str_replace('{title}', $prod_values->get('item_name', '', 'RAW'), $body);
         $body = str_replace('{sellername}', $loguser->name, $body);
         $desc = $prod_values->get('description', '', 'ARRAY');
         $desc = strip_tags(trim($desc['data']));
         $body = str_replace('{des}', $desc, $body);
         $body = str_replace('{link}', JUri::base() . 'administrator/index.php?option=com_quick2cart&view=products&filter_published=0', $body);
         for ($i = 0; $i < count($multiple_img); $i++) {
             $body .= '<br><img src="' . JUri::ROOT() . 'images/quick2cart/' . $multiple_img[$i] . '" alt="No image" ><br>';
         }
     }
     $res = $comquick2cartHelper->sendmail($mailfrom, $subject, $body, $sendto);
 }