예제 #1
0
 function showCheckoutNavigation($step)
 {
     $jshopConfig = JSFactory::getConfig();
     if (!$jshopConfig->ext_menu_checkout_step && in_array($step, array('0', '1'))) {
         return '';
     }
     if ($jshopConfig->step_4_3) {
         $array_navigation_steps = array('0' => _JSHOP_CART, '1' => _JSHOP_LOGIN, '2' => _JSHOP_STEP_ORDER_2, '4' => _JSHOP_STEP_ORDER_4, '3' => _JSHOP_STEP_ORDER_3, '5' => _JSHOP_STEP_ORDER_5);
     } else {
         $array_navigation_steps = array('0' => _JSHOP_CART, '1' => _JSHOP_LOGIN, '2' => _JSHOP_STEP_ORDER_2, '3' => _JSHOP_STEP_ORDER_3, '4' => _JSHOP_STEP_ORDER_4, '5' => _JSHOP_STEP_ORDER_5);
     }
     $output = array();
     $cssclass = array();
     if (!$jshopConfig->ext_menu_checkout_step) {
         unset($array_navigation_steps['0']);
         unset($array_navigation_steps['1']);
     }
     if ($jshopConfig->shop_user_guest == 2) {
         unset($array_navigation_steps['1']);
     }
     if ($jshopConfig->without_shipping || $jshopConfig->hide_shipping_step) {
         unset($array_navigation_steps['4']);
     }
     if ($jshopConfig->without_payment || $jshopConfig->hide_payment_step) {
         unset($array_navigation_steps['3']);
     }
     foreach ($array_navigation_steps as $key => $value) {
         if ($key == '0') {
             $url = SEFLink('index.php?option=com_jshopping&controller=cart', 1, 0);
         } elseif ($key == '1') {
             $url = SEFLink('index.php?option=com_jshopping&controller=user&task=login', 1, 0, $jshopConfig->use_ssl);
         } else {
             $url = SEFLink('index.php?option=com_jshopping&controller=checkout&task=step' . $key, 0, 0, $jshopConfig->use_ssl);
         }
         if ($key < $step && !($jshopConfig->step_4_3 && $key == 3 && $step == 4) || $jshopConfig->step_4_3 && $key == 4 && $step == 3) {
             $output[$key] = '<span class="not_active_step"><a href="' . $url . '">' . $value . '</a></span>';
             $cssclass[$key] = "prev";
         } else {
             if ($key == $step) {
                 $output[$key] = '<span id="active_step"  class="active_step">' . $value . '</span>';
                 $cssclass[$key] = "active";
             } else {
                 $output[$key] = '<span class="not_active_step">' . $value . '</span>';
                 $cssclass[$key] = "next";
             }
         }
     }
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplayCheckoutNavigator', array(&$output, &$array_navigation_steps, &$step));
     include_once JPATH_COMPONENT_SITE . "/views/checkout/view.html.php";
     $view_name = "checkout";
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = new JshoppingViewCheckout($view_config);
     $view->setLayout("menu");
     $view->assign('steps', $output);
     $view->assign('step', $step);
     $view->assign('cssclass', $cssclass);
     $view->assign('array_navigation_steps', $array_navigation_steps);
     $dispatcher->trigger('onAfterDisplayCheckoutNavigator', array(&$view));
     return $view->loadTemplate();
 }
예제 #2
0
 function getMessageChangeStatusOrder($order, $newstatus, $vendorinfo, $order_details_url, $comments = '')
 {
     $jshopConfig = JSFactory::getConfig();
     include_once JPATH_COMPONENT_SITE . "/views/checkout/view.html.php";
     $view_name = "order";
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = new JshoppingViewCheckout($view_config);
     $view->setLayout("statusorder");
     $view->assign('order', $order);
     $view->assign('order_status', $newstatus);
     $view->assign('vendorinfo', $vendorinfo);
     $view->assign('order_detail', $order_details_url);
     $view->assign('comment', $comments);
     JDispatcher::getInstance()->trigger('onBeforeCreateMailOrderStatusView', array(&$view));
     return $view->loadTemplate();
 }
예제 #3
0
파일: checkout.php 프로젝트: Tommar/vino2
 function changeStatusOrder($order_id, $status, $sendmessage = 1)
 {
     $mainframe = JFactory::getApplication();
     $lang = JSFactory::getLang();
     $jshopConfig = JSFactory::getConfig();
     $restext = '';
     JPluginHelper::importPlugin('jshoppingorder');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeChangeOrderStatus', array(&$order_id, &$status, &$sendmessage, &$restext));
     $order = JTable::getInstance('order', 'jshop');
     $order->load($order_id);
     $order->order_status = $status;
     $order->store();
     $vendorinfo = $order->getVendorInfo();
     $order_status = JTable::getInstance('orderStatus', 'jshop');
     $order_status->load($status);
     if ($order->order_created && in_array($status, $jshopConfig->payment_status_return_product_in_stock)) {
         $order->changeProductQTYinStock("+");
     }
     $order_history = JTable::getInstance('orderHistory', 'jshop');
     $order_history->order_id = $order->order_id;
     $order_history->order_status_id = $status;
     $order_history->status_date_added = getJsDate();
     $order_history->customer_notify = 1;
     $order_history->comments = $restext;
     $order_history->store();
     if (!$sendmessage) {
         return 1;
     }
     $name = $lang->get("name");
     $uri = JURI::getInstance();
     $liveurlhost = $uri->toString(array("scheme", 'host', 'port'));
     $order_details_url = $liveurlhost . SEFLink('index.php?option=com_jshopping&controller=user&task=order&order_id=' . $order_id, 1);
     if ($order->user_id == -1) {
         $order_details_url = '';
     }
     include_once JPATH_COMPONENT_SITE . "/views/checkout/view.html.php";
     $view_name = "order";
     $view_config = array("template_path" => JPATH_COMPONENT_SITE . "/templates/" . $jshopConfig->template . "/" . $view_name);
     $view = new JshoppingViewCheckout($view_config);
     $view->setLayout("statusorder");
     $view->assign('order', $order);
     $view->assign('order_status', $order_status->{$name});
     $view->assign('vendorinfo', $vendorinfo);
     $view->assign('order_detail', $order_details_url);
     $dispatcher->trigger('onBeforeCreateMailOrderStatusView', array(&$view));
     $message = $view->loadTemplate();
     if ($jshopConfig->admin_show_vendors) {
         $listVendors = $order->getVendors();
     } else {
         $listVendors = array();
     }
     $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;
     if ($jshopConfig->vendor_order_message_type == 3) {
         $vendor_send_order = 1;
     }
     $admin_send_order = 1;
     if ($jshopConfig->admin_not_send_email_order_vendor_order && $vendor_send_order && count($listVendors)) {
         $admin_send_order = 0;
     }
     $mailfrom = $mainframe->getCfg('mailfrom');
     $fromname = $mainframe->getCfg('fromname');
     //message client
     $subject = sprintf(_JSHOP_ORDER_STATUS_CHANGE_SUBJECT, $order->order_number);
     $mailer = JFactory::getMailer();
     $mailer->setSender(array($mailfrom, $fromname));
     $mailer->addRecipient($order->email);
     $mailer->setSubject($subject);
     $mailer->setBody($message);
     $mailer->isHTML(false);
     $send = $mailer->Send();
     //message admin
     if ($admin_send_order) {
         $mailer = JFactory::getMailer();
         $mailer->setSender(array($mailfrom, $fromname));
         $mailer->addRecipient(explode(',', $jshopConfig->contact_email));
         $mailer->setSubject(_JSHOP_ORDER_STATUS_CHANGE_TITLE);
         $mailer->setBody($message);
         $mailer->isHTML(false);
         $send = $mailer->Send();
     }
     //message vendors
     if ($vendors_send_message || $vendor_send_order) {
         foreach ($listVendors as $k => $datavendor) {
             $mailer = JFactory::getMailer();
             $mailer->setSender(array($mailfrom, $fromname));
             $mailer->addRecipient($datavendor->email);
             $mailer->setSubject(_JSHOP_ORDER_STATUS_CHANGE_TITLE);
             $mailer->setBody($message);
             $mailer->isHTML(false);
             $send = $mailer->Send();
         }
     }
     $dispatcher->trigger('onAfterChangeOrderStatus', array(&$order_id, &$status, &$sendmessage));
     return 1;
 }