function send()
 {
     $order_id = JRequest::getInt("order_id");
     $order = JTable::getInstance('order', 'jshop');
     $order->load($order_id);
     JSFactory::loadLanguageFile($order->getLang());
     JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_jshopping/models');
     $checkout = JModelLegacy::getInstance('checkout', 'jshop');
     $checkout->sendOrderEmail($order_id, 1);
     JSFactory::loadAdminLanguageFile();
     $this->setRedirect("index.php?option=com_jshopping&controller=orders&task=show&order_id=" . $order_id, _JSHOP_MAIL_HAS_BEEN_SENT);
 }
Beispiel #2
0
 function send()
 {
     $order_id = JRequest::getInt("order_id");
     $order = JSFactory::getTable('order', 'jshop');
     $order->load($order_id);
     JSFactory::loadLanguageFile($order->getLang());
     $checkout = JSFactory::getModel('checkout', 'jshop');
     $checkout->sendOrderEmail($order_id, 1);
     JSFactory::loadAdminLanguageFile();
     $this->setRedirect("index.php?option=com_jshopping&controller=orders&task=show&order_id=" . $order_id, _JSHOP_MAIL_HAS_BEEN_SENT);
 }
Beispiel #3
0
*/
defined('_JEXEC') or die('Restricted access');
if (!JFactory::getUser()->authorise('core.manage', 'com_jshopping')) {
    return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
JTable::addIncludePath(JPATH_COMPONENT_SITE . '/tables');
require_once JPATH_COMPONENT_SITE . "/lib/factory.php";
require_once JPATH_COMPONENT_ADMINISTRATOR . '/functions.php';
$ajax = JRequest::getInt('ajax');
$admin_load_user_id = JRequest::getInt('admin_load_user_id');
$adminlang = JFactory::getLanguage();
if ($admin_load_user_id) {
    JSFactory::setLoadUserId($admin_load_user_id);
}
if (!JRequest::getVar("js_nolang")) {
    JSFactory::loadAdminLanguageFile();
}
$db = JFactory::getDBO();
$jshopConfig = JSFactory::getConfig();
$jshopConfig->setLang($jshopConfig->getFrontLang());
if ($jshopConfig->adminLanguage != $adminlang->getTag()) {
    $config = new jshopConfig($db);
    $config->id = $jshopConfig->load_id;
    $config->adminLanguage = $adminlang->getTag();
    if (!$config->store()) {
        JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
        return 0;
    }
}
if (!$ajax) {
    installNewLanguages();
Beispiel #4
0
    function _updateStatus($order_id, $order_status, $status_id, $notify, $comments, $include, $view_order) {
        $mainframe =& JFactory::getApplication();
        $jshopConfig = &JSFactory::getConfig();
        
        JPluginHelper::importPlugin('jshoppingorder');
        $dispatcher =& JDispatcher::getInstance();
        $dispatcher->trigger( 'onBeforeChangeOrderStatusAdmin', array(&$order_id, &$order_status, &$status_id, &$notify, &$comments, &$include, &$view_order) );
        
        $order = &JTable::getInstance('order', 'jshop');
        $order->load($order_id);        
        
        JSFactory::loadLanguageFile($order->getLang());        
        $prev_order_status = $order->order_status;
        $order->order_status = $order_status;
        $order->order_m_date = date("Y-m-d H:i:s");
        $order->store();
        //////////////////////////////////////////////////////////////////////////
       	// OSE  added
       	//////////////////////////////////////////////////////////////////////////
       	//2=>Confirmed, 1=>Pending, 4=>Refunded
        if ($order_status == "2" || $order_status == "1" || $order_status == "4")
        {
        	require_once(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'init.php');
        	require_once(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'helpers'.DS.'oseMscPublic.php');
        	$db = &JFactory::getDBO();
        	$jquery = "SELECT user_id FROM `#__jshopping_orders` WHERE `order_id` = '" . $db->getEscaped($order_id) . "'";
        	$db->setQuery($jquery);
        	$user_id = $db->loadResult();
        	$jquery = "SELECT a.product_id, b.category_id FROM `#__jshopping_order_item` as a, `#__jshopping_products_to_categories` as b WHERE a.`order_id` = '" . $db->getEscaped($order_id) . "' AND a.`product_id` = b.`product_id`";
        	$db->setQuery($jquery);
        	$results = $db->loadObjectList();
        	$cart = oseMscPublic::getCart();
  
        	foreach ($results as $result)
        	{
        		//////////////////////////////////////////////////
        		$product_id = $result->product_id;
        		$jquery = "SELECT * FROM `#__osemsc_ext` WHERE `type` = 'jshopping'";
        		$db->setQuery($jquery);
        		$db->query();
        		$rows = $db->loadObjectList();
        		foreach ($rows as $row)
        		{
        			$msc_data = oseJson::decode($row->params);
        			$left_var = "";
        			$right_var = "";
        			if ($msc_data->category_id > 0)
        			{
        				$left_var = $result->category_id;
        				$right_var = $msc_data->category_id;
        			}
        			else
        			{
        				$left_var = $result->product_id;
        				$right_var = $msc_data->product_id;
        			}
        			if ($left_var == $right_var)
        			{
        				$msc_id = $row->id;
        				$query = "SELECT currency_code FROM `#__jshopping_orders` WHERE `order_id` = ".(int)$order_id;
        				$db->setQuery($query);
        				$currency = $db->loadResult();

        				if ($order_status == "2")
        				{
        					$member= oseRegistry :: call('member');
        					$member->instance($user_id, 'member_id');

        					// get current item
        					$cart->updateParams('payment_mode','m');
        					$paymentInfo = oseRegistry::call('msc')->getPaymentMscInfo($msc_id,$currency,0);
        					$nItem = array('entry_id'=>$msc_id,'entry_type'=>'msc','msc_option'=>oseObject::getValue($paymentInfo,'msc_option'));
        					$cart->addItem($nItem['entry_id'],$nItem['entry_type'],$nItem);

        					$cart->update();

        					// join msc
        					oseRegistry::call('msc')->runAddonAction('register.payment.save',array('member_id'=>$user_id,'payment_method'=>'none'), true, false);
        					$msc_order_id = JRequest::getInt('order_id',0);

        					oseRegistry::call('payment')->getInstance('Order')->confirmOrder($msc_order_id, array());
        				}
        				else
        				{
        					$msc_id= $row->id;
        					$member= oseRegistry :: call('member');
        					$member->instance($user_id, 'member_id');
        					$params = $member->getAddonParams($msc_id,$user_id,0,$params = array());
        					$updated= $msc->runAddonAction('member.msc.cancelMsc', $params);
        				}
                     }
                  }
             }
                
        }
        //////////////////////////////////////////////////////////////////////////
        $vendorinfo = $order->getVendorInfo();
        
        if (in_array($order_status, $jshopConfig->payment_status_return_product_in_stock) && !in_array($prev_order_status, $jshopConfig->payment_status_return_product_in_stock)){
            $order->changeProductQTYinStock("+");            
        }
        
        if (in_array($prev_order_status, $jshopConfig->payment_status_return_product_in_stock) && !in_array($order_status, $jshopConfig->payment_status_return_product_in_stock)){
            $order->changeProductQTYinStock("-");            
        }
        
        $order_history = &JTable::getInstance('orderHistory', 'jshop');
        $order_history->order_id = $order_id;
        $order_history->order_status_id = $order_status;
        $order_history->status_date_added = date("Y-m-d H:i:s");
        $order_history->customer_notify = $notify;
        $order_history->comments = $comments;

        $order_history->store();
        
        $vendors_send_message = ($jshopConfig->vendor_order_message_type==1 || ($order->vendor_type==1 && $jshopConfig->vendor_order_message_type==2));
        $vendor_send_order = ($jshopConfig->vendor_order_message_type==2 && $order->vendor_type == 0 && $order->vendor_id);
        $admin_send_order = 1;
        if ($jshopConfig->admin_not_send_email_order_vendor_order && $vendor_send_order) $admin_send_order = 0;

        $lang = &JSFactory::getLang($order->getLang());
        $new_status = &JTable::getInstance('orderStatus', 'jshop'); 
        $new_status->load($order_status);
        $comments = ($include)?($comments):('');
        $name = $lang->get('name');
        
        $mailfrom = $mainframe->getCfg( 'mailfrom' );
        $fromname = $mainframe->getCfg( 'fromname' );
        
        $view=&$this->getView("orders_show", 'html');
        $view->setLayout("statusorder");        
        $view->assign('order', $order);
        $view->assign('comment', $comments);
        $view->assign('order_status', $new_status->$name);        
        $view->assign('vendorinfo', $vendorinfo);        
        $message = $view->loadTemplate();
            
        //message client
        if ($notify){            
            $subject = sprintf(_JSHOP_ORDER_STATUS_CHANGE_SUBJECT, $order->order_number);
            JUtility::sendMail($mailfrom, $fromname, $order->email, $subject, $message, 0);
        }
        
        //message vendors
        if ($vendors_send_message){
            $subject = sprintf(_JSHOP_ORDER_STATUS_CHANGE_SUBJECT, $order->order_number);
            $listVendors = $order->getVendors();            
            foreach($listVendors as $k=>$datavendor){
                JUtility::sendMail($mailfrom, $fromname, $datavendor->email, $subject, $message, 0);
            }
        }
        
        JSFactory::loadAdminLanguageFile();
        
        $dispatcher->trigger( 'onAfterChangeOrderStatusAdmin', array(&$order_id, &$order_status, &$status_id, &$notify, &$comments, &$include, &$view_order) );
        
        if ($view_order)
            $this->setRedirect("index.php?option=com_jshopping&controller=orders&task=show&order_id=".$order_id, _JSHOP_ORDER_STATUS_CHANGED);
        else
            $this->setRedirect("index.php?option=com_jshopping&controller=orders", _JSHOP_ORDER_STATUS_CHANGED);
    }