Beispiel #1
0
 public static function createTotalDiagram($report, $startdate, $enddate, $configs)
 {
     $diagram = "";
     $edit_line = DigiComDiagram::getEditLine($report, $startdate, $enddate, $configs);
     $max_amout = 0;
     foreach ($edit_line as $key => $value) {
         $sum = ceil(DigiComDiagram::getAmount($report, $startdate, $enddate, $key));
         if ($max_amout < $sum) {
             $max_amout = $sum;
         }
     }
     $roud_max_amount = $max_amout;
     if ($max_amout > 10) {
         $roud_max_amount = DigiComDiagram::roundToMax($max_amout);
     }
     $scale = DigiComDiagram::getSumScale($report, $roud_max_amount);
     $padding = array("0" => "0", "1" => "50", "2" => "50", "3" => "50");
     $width = "40%";
     $margin_left = "";
     if ($report == "monthly") {
         $width = "70%";
         $margin_left = "margin-left:35px !important;";
     }
     $diagram .= '<table style="width:' . $width . '">';
     $diagram .= '<tr>';
     $diagram .= '<td width="60px" align="right">';
     //start sum line ------------------------------------------
     $diagram .= '<div id="sum_line">';
     if (isset($scale) && count($scale) > 0) {
         foreach ($scale as $key => $value) {
             $diagram .= '<div style="padding-top: ' . $padding[$key] . 'px;">' . $value . ' -</div>';
         }
         $diagram .= '<div style="padding-top: 50px;">0</div>';
     }
     $diagram .= '</div>';
     //end sum line ------------------------------------------
     $diagram .= '</td>';
     $diagram .= '<td id="td_lines">';
     $diagram .= '<table style="margin-bottom:-5px;"><tr>';
     if (isset($edit_line) && count($edit_line) > 0) {
         foreach ($edit_line as $key => $value) {
             $diagram .= '<td style="width:40px;" nowrap="nowrap">';
             $diagram .= '<div id="all_element">';
             $diagram .= '<div id="diagram_element" style="' . $margin_left . '">';
             $sum = DigiComDiagram::getAmount($report, $startdate, $enddate, $key);
             if (isset($sum)) {
                 $total = str_replace(",", "", $scale["0"]);
                 $padding = $sum * 270 / $total;
                 $padding = intval(270 - $padding);
                 $padding = $padding > 258 ? 258 : $padding;
                 $sum = DigiComHelperDigiCom::format_price($sum, $configs->get('currency', 'USD'), true, $configs);
             } else {
                 $padding = 270;
                 $sum = "";
             }
             $diagram .= '<div style="background-color: #FFFFFF; padding-top: ' . $padding . 'px;">';
             $diagram .= '<span style="font-size: smaller; white-space: nowrap;">' . $sum . "</span>";
             $diagram .= '</div>';
             $diagram .= '</div>';
             $diagram .= '</div>';
             $diagram .= '</td>';
         }
     }
     $diagram .= '</tr></table>';
     $diagram .= '</td>';
     $diagram .= '</tr>';
     //start edit line ------------------------------------------
     $diagram .= '<tr>';
     if (isset($edit_line) && count($edit_line) > 0) {
         $diagram .= '<td>';
         $diagram .= '</td>';
         $diagram .= '<td>';
         $diagram .= '<table>';
         $diagram .= '<tr>';
         foreach ($edit_line as $key => $value) {
             $width = " width: 30px; ";
             if ($key != count($edit_line) - 1) {
                 $width = " width: 50px; ";
             }
             $diagram .= '<td style="' . $width . ' text-align:right;">';
             $diagram .= $value;
             $diagram .= '</td>';
         }
         $diagram .= '</tr>';
         $diagram .= '</table>';
         $diagram .= '</td>';
     }
     $diagram .= '<tr>';
     //end edit line ------------------------------------------
     $diagram .= '</table>';
     return $diagram;
 }
Beispiel #2
0
						<td>
							<?php 
    switch ($item->product_type) {
        case 'bundle':
            echo JText::_('COM_DIGICOM_PRODUCTS_TYPE_BUNDLE');
            break;
        case 'reguler':
        default:
            echo JText::_('COM_DIGICOM_PRODUCTS_TYPE_SINGLE');
            break;
    }
    ?>
						</td>
						<td class="small">
							<?php 
    echo DigiComHelperDigiCom::format_price($item->price, $this->configs->get('currency', 'USD'), true, $this->configs);
    ?>
						</td>
						<td class="small hidden-phone">
								<?php 
    echo DigiComSiteHelperPrice::getProductValidityPeriod($item);
    ?>
						</td>
						<td align="center" style="text-align: center; ">
							<?php 
    echo $item->hide_public ? '<span class="label label-important">' . JText::_("JNO") . '</span>' : '<span class="label label-success">' . JText::_("JYES") . '</span>';
    ?>
						</td>
						<td class="small hidden-phone">
							<?php 
    echo $this->escape($item->access_level);
Beispiel #3
0
								</span>
							</td>
							<td>
								<strong class="row-title">
									<a href="index.php?option=com_digicom&view=customer&layout=edit&id=<?php 
    echo $order->userid;
    ?>
">
										<?php 
    echo $order->firstname . ' ' . $order->lastname;
    ?>
									</a>
								</strong>
							</td>
							<td><span class="small pull-right"><?php 
    echo DigiComHelperDigiCom::format_price($order->amount, $order->currency, true, $configs);
    ?>
</span></td>
							<td><span class="small"><?php 
    echo date("Y-m-d", $order->order_date);
    ?>
</span></td>
						</tr>
						
					<?php 
}
?>
					</table>
					<a href="index.php?option=com_digicom&view=orders"><?php 
echo JText::_('COM_DIGICOM_ALL_ORDERS');
?>
Beispiel #4
0
</a>
						</td>

						<td>
							<a href="<?php 
    echo $link;
    ?>
" ><?php 
    echo $promo->code;
    ?>
</a>
						</td>

						<td align="center">
							<?php 
    echo $promo->promotype == '0' ? DigiComHelperDigiCom::format_price($promo->amount, $configs->get('currency', 'USD'), true, $configs) : $promo->amount . ' %';
    ?>
						</td>

						<td align="center">
							<?php 
    echo $status;
    ?>
						</td>

						<td align="center">
							<?php 
    echo $promo->used;
    ?>
						</td>
Beispiel #5
0
				<tr>
					<td>Product Name</td>
					<td width="100px">Price</td>
					<td width="1%">Action</td>
				</tr>
			</thead>
			<tbody id="productincludes_items">
				<?php 
$bundle_product = $form_data->get('bundle_product');
if (isset($bundle_product) && count($bundle_product) > 0) {
    foreach ($bundle_product as $key => $include) {
        if (is_array($include)) {
            $include = (object) $include;
        }
        $iprice = isset($include->price) ? $include->price : '';
        $price = DigiComHelperDigiCom::format_price($iprice, $configs->get('currency', 'USD'), true, $configs);
        ?>
						<tr id="productincludes_item_<?php 
        echo $include->id;
        ?>
">
							<td>
								<input type="hidden" id="product_include_id<?php 
        echo $include->id;
        ?>
" name="jform[bundle_product][]" value="<?php 
        echo $include->id;
        ?>
">
								<a href="<?php 
        echo JRoute::_('index.php?option=com_digicom&view=product&layout=edit&id=' . $include->id);
Beispiel #6
0
							<?php 
        echo $order->number_of_products;
        ?>
</a>
						</td>
						<td align="center">
							<?php 
        echo DigiComHelperDigiCom::format_price($order->amount, $configs->get('currency', 'USD'), true, $configs);
        ?>
						</td>
						<td align="center">
							<?php 
        $refunds = DigiComHelperDigiCom::getRefunds($order->id);
        $chargebacks = DigiComHelperDigiCom::getChargebacks($order->id);
        $order->amount_paid = $order->amount_paid - $refunds - $chargebacks;
        echo DigiComHelperDigiCom::format_price($order->amount_paid, $configs->get('currency', 'USD'), true, $configs);
        ?>
						</td>
						<!-- 
						<td align="center">
							<?php 
        echo $order->email;
        ?>
						</td>
						 -->
						 <td align="center">
							<a href="<?php 
        echo $customerlink;
        ?>
" ><?php 
        echo $order->firstname . " " . $order->lastname;
Beispiel #7
0
 function sendApprovedEmail($cid = 0, $type = 'complete_order', $status = 'Active', $paid = '')
 {
     if ($cid < 1) {
         return;
     }
     $db = JFactory::getDBO();
     $order = $this->getTable("Order");
     $order->load($cid);
     $configs = JComponentHelper::getComponent('com_digicom')->params;
     $cust_info = $this->getTable("Customer");
     $cust_info->load($order->userid);
     $my = $cust_info;
     /*		
     $emailinfo = $configs->get('email');
     $message = $emailinfo->$type->body;
     $subject = $emailinfo->$type->subject;
     */
     //echo $type;die;
     $email_settings = $configs->get('email_settings');
     $email_header_image = $email_settings->email_header_image;
     //jform[email_settings][email_header_image]
     if (!empty($email_header_image)) {
         $email_header_image = '<img src="' . JRoute::_(JURI::root() . $email_header_image) . '" />';
     }
     $phone = $configs->get('phone');
     $email_footer = $email_settings->email_footer;
     $emailinfo = $configs->get($type, 'new_order');
     $email_type = $emailinfo->email_type;
     $Subject = $emailinfo->Subject;
     $recipients = $emailinfo->recipients;
     $enable = $emailinfo->enable;
     $heading = $emailinfo->heading;
     //jform[email_settings][heading]
     if (!$enable) {
         return;
     }
     //print_r($emailinfo);die;
     //-----------------------------------------------------------------------
     $path = '/components/com_digicom/emails/';
     switch ($type) {
         case 'new_order':
             $emailType = JText::_('COM_DIGIOM_NEW_ORDER');
             $filename = 'new-order.' . $email_type . '.php';
             break;
         case 'process_order':
             $emailType = JText::_('COM_DIGIOM_PROCESS_ORDER');
             $filename = 'process-order.' . $email_type . '.php';
             break;
         case 'cancel_order':
             $emailType = JText::_('COM_DIGIOM_CANCEL_ORDER');
             $filename = 'cancel-order.' . $email_type . '.php';
             break;
         case 'complete_order':
             $emailType = JText::_('COM_DIGIOM_COMPLETE_ORDER');
             $filename = 'complete-order.' . $email_type . '.php';
             break;
     }
     $override = '/html/com_digicom/emails/';
     $template = $this->getTemplate();
     $client = JApplicationHelper::getClientInfo($template->client_id);
     $filePath = JPath::clean($client->path . '/templates/' . $template->template . $override . '/' . $filename);
     //echo $filePath;die;
     if (file_exists($filePath)) {
         $emailbody = file_get_contents($filePath);
     } else {
         $filePath = JPath::clean($client->path . $path . '/' . $filename);
         $emailbody = file_get_contents($filePath);
     }
     //echo $emailbody;die;
     //-----------------------------------------------------------------------
     //$email = $configs->get('email');
     /*$message = $email->$type->body;
     		$subject = $email->$type->subject;
     		*/
     $message = $emailbody;
     $subject = $Subject;
     $mes = new stdClass();
     $promo = new stdClass();
     //$cart->get_promo($cust_info);
     $promo->id = $order->promocodeid;
     $promo->code = $order->promocode;
     if ($promo->id > 0) {
         $promoid = $promo->id;
         $promocode = $promo->code;
     } else {
         $promoid = '0';
         $promocode = '0';
     }
     $amount = DigiComHelperDigiCom::format_price($paid ? $paid : $order->amount, $configs->get('currency', 'USD'), true, $configs);
     $timestamp = time();
     $app = JFactory::getApplication('administrator');
     $sitename = trim($configs->get('store_name', 'DigiCom Store')) != '' ? $configs->get('store_name', 'DigiCom Store') : $app->getCfg('sitename');
     $siteurl = trim($configs->get('store_url', JURI::root())) != '' ? $configs->get('store_url', JURI::root()) : JURI::root();
     $message = str_replace("[SITENAME]", $sitename, $message);
     $message = str_replace("[EMAIL_TYPE]", $emailType, $message);
     $message = str_replace("[EMAIL_HEADER]", $heading, $message);
     $message = str_replace("[HEADER_IMAGE]", $email_header_image, $message);
     $message = str_replace("../%5BSITEURL%5D", $siteurl, $message);
     $message = str_replace("%5BSITEURL%5D", $siteurl, $message);
     $message = str_replace("[SITEURL]", $siteurl, $message);
     $message = str_replace("[CUSTOMER_USER_NAME]", $my->username, $message);
     $message = str_replace("[CUSTOMER_FIRST_NAME]", $my->firstname, $message);
     $message = str_replace("[CUSTOMER_LAST_NAME]", $my->lastname, $message);
     $message = str_replace("[CUSTOMER_EMAIL]", $my->email, $message);
     $message = str_replace("[ORDER_DATE]", date($configs->get('time_format', 'DD-MM-YYYY'), $timestamp), $message);
     $message = str_replace("[ORDER_ID]", $cid, $message);
     $message = str_replace("[ORDER_AMOUNT]", $amount, $message);
     $message = str_replace("[NUMBER_OF_PRODUCTS]", $order->number_of_products, $message);
     $message = str_replace("[DISCOUNT_AMOUNT]", $order->promocodediscount, $message);
     $message = str_replace("[ORDER_STATUS]", $status, $message);
     $message = str_replace("[STORE_PHONE]", $phone, $message);
     $message = str_replace("[FOOTER_TEXT]", $email_footer, $message);
     $displayed = array();
     $product_list = '';
     $sql = "select od.*, p.name from #__digicom_orders_details od, #__digicom_products p where od.productid=p.id and od.orderid=" . $cid;
     $db->setQuery($sql);
     $items = $db->loadObjectList();
     $product_list = "";
     foreach ($items as $item) {
         $product_list .= $item->quantity . " - " . $item->name . '<br />';
     }
     $message = str_replace("[PRODUCTS]", $product_list, $message);
     //subject
     $subject = str_replace("[SITENAME]", $sitename, $subject);
     $subject = str_replace("../%5BSITEURL%5D", $siteurl, $subject);
     $subject = str_replace("%5BSITEURL%5D", $siteurl, $subject);
     $subject = str_replace("[SITEURL]", $siteurl, $subject);
     $subject = str_replace("[CUSTOMER_USER_NAME]", $my->username, $subject);
     $subject = str_replace("[CUSTOMER_FIRST_NAME]", $my->firstname, $subject);
     $subject = str_replace("[CUSTOMER_LAST_NAME]", $my->lastname, $subject);
     $subject = str_replace("[CUSTOMER_EMAIL]", $my->email, $subject);
     $subject = str_replace("[ORDER_DATE]", date($configs->get('time_format', 'DD-MM-YYYY'), $timestamp), $subject);
     $subject = str_replace("[ORDER_ID]", $cid, $subject);
     $subject = str_replace("[ORDER_AMOUNT]", $amount, $subject);
     $subject = str_replace("[NUMBER_OF_PRODUCTS]", $order->number_of_products, $subject);
     $subject = str_replace("[DISCOUNT_AMOUNT]", $order->promocodediscount, $subject);
     $subject = str_replace("[ORDER_STATUS]", $status, $subject);
     $subject = str_replace("{site_title}", $sitename, $subject);
     $subject = str_replace("{order_number}", $cid, $subject);
     $subject = str_replace("{order_date}", date($configs->get('time_format', 'd-m-Y'), $timestamp), $subject);
     $message = str_replace("{site_title}", $sitename, $message);
     $message = str_replace("{order_number}", $cid, $message);
     $message = str_replace("{order_date}", date($configs->get('time_format', 'd-m-Y'), $timestamp), $message);
     $subject = str_replace("[PRODUCTS]", $product_list, $subject);
     //replace styles
     $basecolor = $email_settings->email_base_color;
     //
     $basebgcolor = $email_settings->email_bg_color;
     //
     $tmplcolor = $email_settings->email_body_color;
     //
     $tmplbgcolor = $email_settings->email_body_bg_color;
     //
     $message = str_replace("[BASE_COLOR]", $basecolor, $message);
     $message = str_replace("[BASE_BG_COLOR]", $basebgcolor, $message);
     $message = str_replace("[TMPL_COLOR]", $tmplcolor, $message);
     $message = str_replace("[TMPL_BG_COLOR]", $tmplbgcolor, $message);
     $subject = html_entity_decode($subject, ENT_QUOTES);
     $message = html_entity_decode($message, ENT_QUOTES);
     // Send email to user
     //global $mosConfig_mailfrom, $mosConfig_fromname, $configs;
     $mosConfig_mailfrom = $app->getCfg("mailfrom");
     $mosConfig_fromname = $app->getCfg("fromname");
     if ($configs->get('usestoremail', 0) == '1' && strlen(trim($configs->get('store_name', 'DigiCom Store'))) > 0 && strlen(trim($configs->get('store_email', JFactory::getConfig()->get('mailfrom')))) > 0) {
         $adminName2 = $configs->get('store_name', 'DigiCom Store');
         $adminEmail2 = $configs->get('store_email', JFactory::getConfig()->get('mailfrom'));
     } else {
         if ($mosConfig_mailfrom != "" && $mosConfig_fromname != "") {
             $adminName2 = $mosConfig_fromname;
             $adminEmail2 = $mosConfig_mailfrom;
         } else {
             $query = "SELECT name, email" . "\n FROM #__users" . "\n WHERE LOWER( usertype ) = 'superadministrator'" . "\n OR LOWER( usertype ) = 'super administrator'";
             $database->setQuery($query);
             $rows = $database->loadObjectList();
             $row2 = $rows[0];
             $adminName2 = $row2->name;
             $adminEmail2 = $row2->email;
         }
     }
     $mailSender = JFactory::getMailer();
     $mailSender->IsHTML(true);
     $mailSender->addRecipient($my->email);
     $mailSender->setSender(array($adminEmail2, $adminName2));
     $mailSender->setSubject($subject);
     $mailSender->setBody($message);
     if (!$mailSender->Send()) {
         //<Your error code management>
     }
     //	mosMail( $adminEmail2, $adminName2, $my->email, $subject, $message, 1 ); // Send mail
     if ($configs->get('sendmailtoadmin', 0) != 0) {
         $mailSender = JFactory::getMailer();
         $mailSender->IsHTML(true);
         $mailSender->addRecipient($adminEmail2);
         $mailSender->setSender(array($adminEmail2, $adminName2));
         $mailSender->setSubject($subject);
         $mailSender->setBody($message);
         if (!$mailSender->Send()) {
             //<Your error code management>
         }
         //mosMail( $adminEmail2, $adminName2, $adminEmail2, $subject, $message, 1 ); // Send mail
     }
     return true;
 }