コード例 #1
0
 public function display($tpl = null)
 {
     global $context;
     $model = $this->getModel('opsearch');
     $uri = JFactory::getURI();
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $order_function = new order_functions();
     $document->addStyleSheet('components/com_redshop/assets/css/search.css');
     $document->addScript('components/com_redshop/assets/js/search.js');
     $document->setTitle(JText::_('COM_REDSHOP_PRODUCT_ORDER_SEARCH_BY_CUSTOMER'));
     JToolBarHelper::title(JText::_('COM_REDSHOP_PRODUCT_ORDER_SEARCH_BY_CUSTOMER'), 'redshop_order48');
     $lists['order'] = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'order_item_name');
     $lists['order_Dir'] = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
     $filter_user = $app->getUserStateFromRequest($context . 'filter_user', 'filter_user', 0);
     $filter_status = $app->getUserStateFromRequest($context . 'filter_status', 'filter_status', 0);
     $products = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     $lists['filter_user'] = $model->getuserlist('filter_user', $filter_user, 'class="inputbox" size="1" onchange="document.adminForm.submit();"');
     $lists['filter_status'] = $order_function->getstatuslist('filter_status', $filter_status, 'class="inputbox" size="1" onchange="document.adminForm.submit();"');
     $this->lists = $lists;
     $this->products = $products;
     $this->pagination = $pagination;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
コード例 #2
0
 public function store($data)
 {
     $order_functions = new order_functions();
     $plg_manufacturer = $order_functions->getparameters('plg_manucaturer_excluding_category');
     if (count($plg_manufacturer) > 0 && $plg_manufacturer[0]->enabled) {
         $data['excluding_category_list'] = @implode(',', $data['excluding_category_list']);
     }
     $row =& $this->getTable();
     if ($data['manufacturer_id'] == 0) {
         $data['ordering'] = $this->MaxOrdering();
     }
     if (!$row->bind($data)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if (count($plg_manufacturer) > 0 && $plg_manufacturer[0]->enabled) {
         if (!$row->excluding_category_list) {
             $row->excluding_category_list = '';
         }
     }
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     return $row;
 }
コード例 #3
0
ファイル: view.html.php プロジェクト: jaanusnurmoja/redjoomla
 public function display($tpl = null)
 {
     $option = JRequest::getVar('option');
     $extra_field = new extra_field();
     $order_functions = new order_functions();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_QUOTATION_MANAGEMENT'));
     $document->addScript('components/' . $option . '/assets/js/json.js');
     $document->addScript('components/' . $option . '/assets/js/validation.js');
     $document->addScript('components/' . $option . '/assets/js/order.js');
     $document->addScript('components/' . $option . '/assets/js/common.js');
     $document->addScript('components/' . $option . '/assets/js/select_sort.js');
     $document->addStyleSheet('components/' . $option . '/assets/css/search.css');
     $document->addScript('components/' . $option . '/assets/js/search.js');
     $session = JFactory::getSession();
     $uri = JFactory::getURI();
     $lists = array();
     $model = $this->getModel();
     $detail = $this->get('Data');
     $Redconfiguration = new Redconfiguration();
     $user_id = JRequest::getVar('user_id', 0);
     if ($user_id != 0) {
         $billing = $order_functions->getBillingAddress($user_id);
     } else {
         $billing = $model->setBilling();
     }
     if (!is_object($detail)) {
         $detail = new stdClass();
     }
     $detail->user_id = $user_id;
     $session->set('offlineuser_id', $user_id);
     $userop = array();
     $userop[0] = new stdClass();
     $userop[0]->user_id = 0;
     $userop[0]->text = JText::_('COM_REDSHOP_SELECT');
     $userlists = $model->getUserData(0, "BT");
     $userlist = array_merge($userop, $userlists);
     $lists['userlist'] = JHTML::_('select.genericlist', $userlist, 'user_id', 'class="inputbox" onchange="showquotationUserDetail();" ', 'user_id', 'text');
     JToolBarHelper::title(JText::_('COM_REDSHOP_QUOTATION_MANAGEMENT') . ': <small><small>[ ' . JText::_('COM_REDSHOP_NEW') . ' ]</small></small>', 'redshop_order48');
     JToolBarHelper::save();
     JToolBarHelper::custom('send', 'send.png', 'send.png', JText::_('COM_REDSHOP_SEND'), false);
     JToolBarHelper::cancel();
     // PRODUCT/ATTRIBUTE STOCK ROOM QUANTITY CHECKING IS IMPLEMENTED
     $countryarray = $Redconfiguration->getCountryList((array) $billing);
     $billing->country_code = $countryarray['country_code'];
     $lists['country_code'] = $countryarray['country_dropdown'];
     $statearray = $Redconfiguration->getStateList((array) $billing);
     $lists['state_code'] = $statearray['state_dropdown'];
     $lists['quotation_extrafield'] = $extra_field->list_all_field(16, $billing->users_info_id);
     $this->lists = $lists;
     $this->detail = $detail;
     $this->billing = $billing;
     $this->userlist = $userlists;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
コード例 #4
0
 /**
  * Method to edit billing Address
  *
  * @return  boolean  True if the ID is in the edit list.
  */
 public function edit()
 {
     $user = JFactory::getUser();
     $order_functions = new order_functions();
     $billingaddresses = $order_functions->getBillingAddress($user->id);
     $GLOBALS['billingaddresses'] = $billingaddresses;
     $task = JRequest::getVar('submit', 'post');
     if ($task == 'Cancel') {
         $this->registerTask('save', 'cancel');
     }
     parent::display();
 }
コード例 #5
0
 public function _initData()
 {
     if (empty($GLOBALS['billingaddresses'])) {
         $session = JFactory::getSession();
         $auth = $session->get('auth');
         if (isset($auth['users_info_id']) && $auth['users_info_id']) {
             $order_functions = new order_functions();
             $detail = $order_functions->getBillingAddress(-$auth['users_info_id']);
             if (!isset($detail->user_id)) {
                 $detail->user_id = -$auth['users_info_id'];
             }
         } else {
             // Toggler settings
             $is_company = DEFAULT_CUSTOMER_REGISTER_TYPE == 2 ? 1 : 0;
             // Allow registration type settings
             if (ALLOW_CUSTOMER_REGISTER_TYPE == 1) {
                 $is_company = 0;
             } elseif (ALLOW_CUSTOMER_REGISTER_TYPE == 2) {
                 $is_company = 1;
             }
             $user = JFactory::getUser();
             $detail = new stdClass();
             $detail->users_info_id = 0;
             $detail->user_id = $user->id;
             $detail->id = $user->id;
             $detail->name = $user->name;
             $detail->username = $user->username;
             $detail->email = $user->email;
             $detail->user_email = $user->email;
             $detail->password = null;
             $detail->is_company = $is_company;
             $detail->firstname = null;
             $detail->lastname = null;
             $detail->address_type = 'BT';
             $detail->company_name = null;
             $detail->vat_number = null;
             $detail->tax_exempt = 0;
             $detail->country_code = null;
             $detail->state_code = null;
             $detail->shopper_group_id = null;
             $detail->published = 1;
             $detail->address = null;
             $detail->city = null;
             $detail->zipcode = null;
             $detail->phone = null;
             $detail->requesting_tax_exempt = 0;
             $detail->tax_exempt_approved = 0;
             $detail->approved = 1;
         }
         return $detail;
     }
 }
コード例 #6
0
 public function display($tpl = null)
 {
     $context = 'order_id';
     require_once JPATH_COMPONENT . '/helpers/order.php';
     $order_function = new order_functions();
     $uri = JFactory::getURI();
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_ORDER'));
     $model = $this->getModel('order');
     $layout = JRequest::getVar('layout');
     if ($layout == 'previewlog') {
         $this->setLayout($layout);
     } elseif ($layout == 'labellisting') {
         JToolBarHelper::title(JText::_('COM_REDSHOP_DOWNLOAD_LABEL'), 'redshop_order48');
         $this->setLayout('labellisting');
         JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
     } else {
         JToolBarHelper::custom('multiprint_order', 'print_f2.png', 'print_f2.png', JText::_('COM_REDSHOP_MULTI_PRINT_ORDER_LBL'), true);
         JToolBarHelper::title(JText::_('COM_REDSHOP_ORDER_MANAGEMENT'), 'redshop_order48');
         JToolBarHelper::addNewX();
         JToolBarHelper::custom('allstatus', 'save.png', 'save_f2.png', JText::_('COM_REDSHOP_CHANGE_STATUS_TO_ALL_LBL'), true);
         JToolBarHelper::custom('export_data', 'save.png', 'save_f2.png', JText::_('COM_REDSHOP_EXPORT_DATA_LBL'), false);
         JToolBarHelper::custom('export_fullorder_data', 'save.png', 'save_f2.png', JText::_('COM_REDSHOP_EXPORT_FULL_DATA_LBL'), false);
         JToolBarHelper::custom('gls_export', 'save.png', 'save_f2.png', JText::_('COM_REDSHOP_EXPORT_GLS_LBL'), false);
         JToolBarHelper::custom('business_gls_export', 'save.png', 'save_f2.png', JText::_('COM_REDSHOP_EXPORT_GLS_BUSINESS_LBL'), false);
         JToolBarHelper::deleteList();
     }
     $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', ' o.order_id ');
     $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', 'DESC');
     $filter_by = $app->getUserStateFromRequest($context . 'filter_by', 'filter_by', '', '');
     $filter_status = $app->getUserStateFromRequest($context . 'filter_status', 'filter_status', '', 'string');
     $filter_payment_status = $app->getUserStateFromRequest($context . 'filter_payment_status', 'filter_payment_status', '', '');
     $lists['order'] = $filter_order;
     $lists['order_Dir'] = $filter_order_Dir;
     $orders = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     $lists['filter_by'] = $order_function->getFilterbyList('filter_by', $filter_by, 'class="inputbox" size="1"');
     $lists['filter_status'] = $order_function->getstatuslist('filter_status', $filter_status, 'class="inputbox" size="1" onchange="document.adminForm.submit();"');
     $lists['filter_payment_status'] = $order_function->getpaymentstatuslist('filter_payment_status', $filter_payment_status, 'class="inputbox" size="1" onchange="document.adminForm.submit();" ');
     $this->user = JFactory::getUser();
     $this->lists = $lists;
     $this->orders = $orders;
     $this->pagination = $pagination;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
コード例 #7
0
 /**
  * Get Billing Addresses
  *
  * @return  array
  */
 public function billingaddresses()
 {
     $app = JFactory::getApplication();
     $order_functions = new order_functions();
     $user = JFactory::getUser();
     $session = JFactory::getSession();
     $auth = $session->get('auth');
     $list = array();
     if ($user->id) {
         $list = $order_functions->getBillingAddress($user->id);
     } elseif ($auth['users_info_id']) {
         $uid = -$auth['users_info_id'];
         $list = $order_functions->getBillingAddress($uid);
     }
     return $list;
 }
コード例 #8
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $order_functions = new order_functions();
     // Extra_field;
     $extra_field = new extraField();
     $task = JRequest::getCmd('task');
     $user = JFactory::getUser();
     $uri = JFactory::getURI();
     // Preform security checks
     $session = JFactory::getSession();
     $auth = $session->get('auth');
     $params = $app->getParams('com_redshop');
     $lists = array();
     if ($user->id) {
         $billingaddresses = $order_functions->getBillingAddress($user->id);
     } elseif (isset($auth['users_info_id']) && $auth['users_info_id']) {
         $model = $this->getModel('account_shipto');
         $billingaddresses = $model->_loadData($auth['users_info_id']);
     } else {
         $app->Redirect('index.php?option=com_redshop&view=login&Itemid=' . JRequest::getInt('Itemid'));
         exit;
     }
     if ($task == 'addshipping') {
         JHTML::Script('jquery-1.4.2.min.js', 'components/com_redshop/assets/js/', false);
         JHTML::Script('jquery.validate.js', 'components/com_redshop/assets/js/', false);
         JHTML::Script('common.js', 'components/com_redshop/assets/js/', false);
         JHTML::Script('registration.js', 'components/com_redshop/assets/js/', false);
         JHTML::Stylesheet('validation.css', 'components/com_redshop/assets/css/');
         $shippingaddresses = $this->get('Data');
         if ($shippingaddresses->users_info_id > 0 && $shippingaddresses->user_id != $billingaddresses->user_id) {
             echo JText::_('COM_REDSHOP_ALERTNOTAUTH');
             return;
         }
         $lists['shipping_customer_field'] = $extra_field->list_all_field(14, $shippingaddresses->users_info_id);
         $lists['shipping_company_field'] = $extra_field->list_all_field(15, $shippingaddresses->users_info_id);
         $this->setLayout('form');
     } else {
         $shippingaddresses = $order_functions->getShippingAddress($user->id);
     }
     $this->lists = $lists;
     $this->shippingaddresses = $shippingaddresses;
     $this->billingaddresses = $billingaddresses;
     $this->request_url = $uri->toString();
     $this->params = $params;
     parent::display($tpl);
 }
コード例 #9
0
    function display($tpl = null)
    {
        $app = JFactory::getApplication();
        $order_functions = new order_functions();
        $print = JRequest::getInt('print');
        if ($print) {
            ?>
		<script type="text/javascript" language="javascript">
			window.print();
		</script>
	<?php 
        }
        $params = $app->getParams('com_redshop');
        $prodhelperobj = new producthelper();
        $prodhelperobj->generateBreadcrumb();
        $user = JFactory::getUser();
        $session = JFactory::getSession();
        $order_id = $session->get('order_id');
        $oid = JRequest::getInt('oid', $order_id);
        $encr = JRequest::getString('encr');
        $layout = JRequest::getCmd('layout');
        $model = $this->getModel('order_detail');
        $OrdersDetail = $order_functions->getOrderDetails($oid);
        if ($user->id) {
            if ($OrdersDetail->user_id != $user->id) {
                $app->Redirect('index.php?option=com_redshop&view=login&Itemid=' . JRequest::getInt('Itemid'));
                return;
            }
        } else {
            if (isset($encr)) {
                $authorization = $model->checkauthorization($oid, $encr);
                if (!$authorization) {
                    JError::raiseWarning(404, JText::_('COM_REDSHOP_ORDER_ENCKEY_FAILURE'));
                    echo JText::_('COM_REDSHOP_ORDER_ENCKEY_FAILURE');
                    return false;
                }
            } elseif (!$user->id) {
                $app->Redirect('index.php?option=com_redshop&view=login&Itemid=' . JRequest::getInt('Itemid'));
                return;
            }
        }
        $this->OrdersDetail = $OrdersDetail;
        $this->user = $user;
        $this->params = $params;
        parent::display($tpl);
    }
コード例 #10
0
 public function getuseraccountinfo($uid)
 {
     $order_functions = new order_functions();
     $user = JFactory::getUser();
     $session = JFactory::getSession();
     $auth = $session->get('auth');
     $list = array();
     if ($user->id) {
         $list = $order_functions->getBillingAddress($user->id);
     } elseif ($auth['users_info_id']) {
         $uid = -$auth['users_info_id'];
         $list = $order_functions->getBillingAddress($uid);
     }
     if (!empty($list)) {
         $list->email = $list->user_email;
     }
     return $list;
 }
コード例 #11
0
 public function export_data()
 {
     require_once JPATH_COMPONENT . '/helpers/order.php';
     $order_function = new order_functions();
     $model = $this->getModel('order_container');
     $data = $model->export_data();
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     header("Content-type: text/x-csv");
     header("Content-type: text/csv");
     header("Content-type: application/csv");
     header('Content-Disposition: attachment; filename=Order.csv');
     echo "Order id,Fullname,Order Status,Order Date,Total\n\n";
     for ($i = 0; $i < count($data); $i++) {
         echo $data[$i]->order_id . ",";
         echo $data[$i]->firstname . " " . $data[$i]->lastname . ",";
         echo $order_function->getOrderStatusTitle($data[$i]->order_status) . ",";
         echo date('d-m-Y H:i', $data[$i]->cdate) . ",";
         echo REDCURRENCY_SYMBOL . $data[$i]->order_total . "\n";
     }
     exit;
 }
コード例 #12
0
<?php

/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
include_once JPATH_COMPONENT . '/helpers/helper.php';
$configobj = new Redconfiguration();
$order_functions = new order_functions();
$redhelper = new redhelper();
$url = JURI::base();
$Itemid = $redhelper->getCheckoutItemid();
$order_id = JRequest::getInt('oid');
$order = $order_functions->getOrderDetails($order_id);
$orderitem = $order_functions->getOrderItemDetail($order_id);
if ($order->order_total > 0 && !USE_AS_CATALOG) {
    $paymentmethod = $order_functions->getOrderPaymentDetail($order_id);
    $paymentmethod = $order_functions->getPaymentMethodInfo($paymentmethod[0]->payment_method_class);
    $paymentmethod = $paymentmethod[0];
    $paymentpath = JPATH_SITE . '/plugins/redshop_payment/' . $paymentmethod->element . '/' . $paymentmethod->element . '.xml';
    $paymentparams = new JRegistry($paymentmethod->params);
    echo '<div>';
    $is_creditcard = $paymentparams->get('is_creditcard', '');
    $is_redirected = $paymentparams->get('is_redirected', 0);
    if (!$is_creditcard || $is_redirected == 1) {
        $adminpath = JPATH_ADMINISTRATOR . '/components/com_redshop';
コード例 #13
0
 * @copyright Copyright (C) 2010 redCOMPONENT.com. All rights reserved.
 * @license   GNU/GPL, see license.txt or http://www.gnu.org/copyleft/gpl.html
 *            Developed by email@recomponent.com - redCOMPONENT.com
 *
 * redSHOP can be downloaded from www.redcomponent.com
 * redSHOP is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License 2
 * as published by the Free Software Foundation.
 *
 * You should have received a copy of the GNU General Public License
 * along with redSHOP; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
require_once JPATH_COMPONENT . '/helpers/helper.php';
require_once JPATH_SITE . '/administrator/components/com_redshop/helpers/redshop.cfg.php';
$objOrder = new order_functions();
$objconfiguration = new Redconfiguration();
$user = JFactory::getUser();
$shipping_address = $objOrder->getOrderShippingUserInfo($data['order_id']);
$Itemid = $_REQUEST['Itemid'];
$redhelper = new redhelper();
$db = JFactory::getDbo();
$user = JFActory::getUser();
$task = JRequest::getVar('task');
$layout = JRequest::getVar('layout');
$app = JFactory::getApplication();
if ($this->_params->get("currency") != "") {
    $currency_main = $this->_params->get("currency");
} else {
    if (CURRENCY_CODE != "") {
        $currency_main = CURRENCY_CODE;
コード例 #14
0
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
require_once JPATH_COMPONENT . '/helpers/product.php';
include_once JPATH_COMPONENT . '/helpers/helper.php';
include_once JPATH_COMPONENT . '/helpers/cart.php';
$carthelper = new rsCarthelper();
$redconfig = new Redconfiguration();
$configobj = new Redconfiguration();
$redTemplate = new Redtemplate();
$producthelper = new producthelper();
$order_functions = new order_functions();
$redhelper = new redhelper();
$db = JFactory::getDbo();
$url = JURI::base();
$Itemid = $redhelper->getCheckoutItemid();
$order_id = JRequest::getInt('oid');
// For barcode
$model = $this->getModel('order_detail');
$order = $this->OrdersDetail;
$thankyou_text = str_replace('{order_number}', $order->order_number, ORDER_RECEIPT_INTROTEXT);
if ($this->params->get('show_page_title', 1)) {
    ?>
	<div class="componentheading<?php 
    echo $this->params->get('pageclass_sfx');
    ?>
">
コード例 #15
0
ファイル: product.php プロジェクト: jaanusnurmoja/redjoomla
 public function replaceShippingMethod($d = array(), $shipp_users_info_id = 0, $shipping_rate_id = 0, $shipping_box_post_id = 0)
 {
     $producthelper = new producthelper();
     $order_functions = new order_functions();
     if ($shipp_users_info_id > 0) {
         $shippingmethod = $order_functions->getShippingMethodInfo();
         JPluginHelper::importPlugin('redshop_shipping');
         $dispatcher = JDispatcher::getInstance();
         $shippingrate = $dispatcher->trigger('onListRates', array(&$d));
         $ratearr = array();
         $r = 0;
         for ($s = 0; $s < count($shippingmethod); $s++) {
             if (isset($shippingrate[$s]) === false) {
                 continue;
             }
             $rate = $shippingrate[$s];
             if (count($rate) > 0) {
                 $rs = $shippingmethod[$s];
                 for ($i = 0; $i < count($rate); $i++) {
                     $displayrate = $rate[$i]->rate > 0 ? " (" . $producthelper->getProductFormattedPrice($rate[$i]->rate) . " )" : "";
                     $ratearr[$r] = new stdClass();
                     $ratearr[$r]->text = $rs->name . " - " . $rate[$i]->text . $displayrate;
                     $ratearr[$r]->value = $rate[$i]->value;
                     $r++;
                 }
             }
         }
         if (count($ratearr) > 0) {
             if (!$shipping_rate_id) {
                 $shipping_rate_id = $ratearr[0]->value;
             }
             $displayrespoce = JHTML::_('select.genericlist', $ratearr, 'shipping_rate_id', 'class="inputbox" onchange="calculateOfflineShipping();" ', 'value', 'text', $shipping_rate_id);
         } else {
             $displayrespoce = JText::_('COM_REDSHOP_NO_SHIPPING_METHODS_TO_DISPLAY');
         }
     } else {
         $displayrespoce = '<div class="shipnotice">' . JText::_('COM_REDSHOP_FILL_SHIPPING_ADDRESS') . '</div>';
     }
     return $displayrespoce;
 }
コード例 #16
0
 public function getmanufacturercategory($mid, $tblobj)
 {
     $and = "";
     $order_functions = new order_functions();
     $plg_manufacturer = $order_functions->getparameters('plg_manucaturer_excluding_category');
     if (count($plg_manufacturer) > 0 && $plg_manufacturer[0]->enabled && $tblobj->excluding_category_list != '') {
         $excluding_category_list = explode(',', $tblobj->excluding_category_list);
         JArrayHelper::toInteger($excluding_category_list);
         $excluding_category_list = implode(',', $excluding_category_list);
         $and = "AND c.category_id NOT IN (" . $excluding_category_list . ") ";
     }
     $query = "SELECT DISTINCT(c.category_id), c.category_name,c.category_short_description,c.category_description " . "FROM " . $this->_table_prefix . "product AS p " . "LEFT JOIN " . $this->_table_prefix . "product_category_xref AS pc ON p.product_id=pc.product_id " . "LEFT JOIN " . $this->_table_prefix . "category AS c ON pc.category_id=c.category_id " . "WHERE p.published = 1 " . "AND p.manufacturer_id = " . (int) $mid . " " . "AND p.expired = 0 " . "AND p.product_parent_id = 0 " . $and;
     $this->_db->setQuery($query);
     return $this->_db->loadObjectlist();
 }
コード例 #17
0
 public function store($postdata)
 {
     $redshopMail = new redshopMail();
     $order_functions = new order_functions();
     $helper = new redhelper();
     $producthelper = new producthelper();
     $rsCarthelper = new rsCarthelper();
     $shippinghelper = new shipping();
     $adminproducthelper = new adminproducthelper();
     $stockroomhelper = new rsstockroomhelper();
     // For barcode generation
     $barcode_code = $order_functions->barcode_randon_number(12, 0);
     $postdata['barcode'] = $barcode_code;
     $row = $this->getTable('order_detail');
     if (!$row->bind($postdata)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $iscrm = $helper->isredCRM();
     if ($iscrm) {
         $postdata['order_id'] = $row->order_id;
         $postdata['debitor_id'] = $postdata['user_info_id'];
         JTable::addIncludePath(REDCRM_ADMIN . '/tables');
         $crmorder =& $this->getTable('crm_order');
         if (!$crmorder->bind($postdata)) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         if (!$crmorder->store()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         // Update rma table entry
         if (ENABLE_RMA && isset($postdata['rmanotes'])) {
             $rmaInfo = $this->getTable('rma_orders');
             $rmaInfo->rma_number = $postdata['rma_number'];
             $rmaInfo->original_order_id = $postdata['main_order_id'];
             $rmaInfo->credit_note_order_id = $row->order_id;
             $rmaInfo->rma_note = $postdata['rmanotes'];
             $rmaInfo->store();
         }
         JTable::addIncludePath(REDSHOP_ADMIN . '/tables');
     }
     $order_shipping = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $row->ship_method_id)));
     $rowOrderStatus =& $this->getTable('order_status_log');
     $rowOrderStatus->order_id = $row->order_id;
     $rowOrderStatus->order_status = $row->order_status;
     $rowOrderStatus->date_changed = time();
     $rowOrderStatus->customer_note = $row->customer_note;
     $rowOrderStatus->store();
     $billingaddresses = $order_functions->getBillingAddress($row->user_id);
     if (isset($postdata['billisship']) && $postdata['billisship'] == 1) {
         $shippingaddresses = $billingaddresses;
     } else {
         $key = 0;
         $shippingaddresses = $order_functions->getShippingAddress($row->user_id);
         $shipp_users_info_id = isset($postdata['shipp_users_info_id']) && $postdata['shipp_users_info_id'] != 0 ? $postdata['shipp_users_info_id'] : 0;
         if ($shipp_users_info_id != 0) {
             for ($o = 0; $o < count($shippingaddresses); $o++) {
                 if ($shippingaddresses[$o]->users_info_id == $shipp_users_info_id) {
                     $key = $o;
                     break;
                 }
             }
         }
         $shippingaddresses = $shippingaddresses[$key];
     }
     // ORDER DELIVERY TIME IS REMAINING
     $user_id = $row->user_id;
     $item = $postdata['order_item'];
     for ($i = 0; $i < count($item); $i++) {
         $product_id = $item[$i]->product_id;
         $quantity = $item[$i]->quantity;
         $product_excl_price = $item[$i]->prdexclprice;
         $product_price = $item[$i]->productprice;
         // Attribute price added
         $generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id);
         $retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity);
         $product_attribute = $retAttArr[0];
         // Accessory price
         $generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id);
         $retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id);
         $product_accessory = $retAccArr[0];
         $accessory_total_price = $retAccArr[1];
         $accessory_vat_price = $retAccArr[2];
         $wrapper_price = 0;
         $wrapper_vat = 0;
         if ($item[$i]->wrapper_data != 0 && $item[$i]->wrapper_data != '') {
             $wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data);
             if (count($wrapper) > 0) {
                 if ($wrapper[0]->wrapper_price > 0) {
                     $wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id);
                 }
                 $wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat;
             }
         }
         $product = $producthelper->getProductById($product_id);
         $rowitem =& $this->getTable('order_item_detail');
         if (!$rowitem->bind($postdata)) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         // STOCKROOM update
         $updatestock = $stockroomhelper->updateStockroomQuantity($product_id, $quantity);
         $stockroom_id_list = $updatestock['stockroom_list'];
         $stockroom_quantity_list = $updatestock['stockroom_quantity_list'];
         $rowitem->stockroom_id = $stockroom_id_list;
         $rowitem->stockroom_quantity = $stockroom_quantity_list;
         $rowitem->order_item_id = 0;
         $rowitem->order_id = $row->order_id;
         $rowitem->user_info_id = $row->user_info_id;
         $rowitem->supplier_id = $product->manufacturer_id;
         $rowitem->product_id = $product_id;
         $rowitem->order_item_sku = $product->product_number;
         $rowitem->order_item_name = $product->product_name;
         $rowitem->product_quantity = $quantity;
         $rowitem->product_item_price = $product_price;
         $rowitem->product_item_price_excl_vat = $product_excl_price;
         $rowitem->product_final_price = $product_price * $quantity;
         $rowitem->order_item_currency = REDCURRENCY_SYMBOL;
         $rowitem->order_status = $row->order_status;
         $rowitem->cdate = $row->cdate;
         $rowitem->mdate = $row->cdate;
         $rowitem->product_attribute = $product_attribute;
         $rowitem->product_accessory = $product_accessory;
         $rowitem->wrapper_id = $item[$i]->wrapper_data;
         $rowitem->wrapper_price = $wrapper_price;
         $rowitem->is_giftcard = 0;
         // RedCRM product purchase price
         if ($iscrm) {
             $crmProductHelper = new crmProductHelper();
             $crmproduct = $crmProductHelper->getProductById($product_id);
             $rowitem->product_purchase_price = $crmproduct->product_purchase_price > 0 ? $crmproduct->product_purchase_price : $crmproduct->product_price;
         }
         if ($producthelper->checkProductDownload($product_id)) {
             $medianame = $producthelper->getProductMediaName($product_id);
             for ($j = 0; $j < count($medianame); $j++) {
                 $product_serial_number = $producthelper->getProdcutSerialNumber($product_id);
                 $producthelper->insertProductDownload($product_id, $user_id, $rowitem->order_id, $medianame[$j]->media_name, $product_serial_number->serial_number);
             }
         }
         if (!$rowitem->store()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         /** my accessory save in table start */
         if (count($generateAccessoryCart) > 0) {
             $attArr = $generateAccessoryCart;
             for ($a = 0; $a < count($attArr); $a++) {
                 $accessory_vat_price = 0;
                 $accessory_attribute = "";
                 $accessory_id = $attArr[$a]['accessory_id'];
                 $accessory_name = $attArr[$a]['accessory_name'];
                 $accessory_price = $attArr[$a]['accessory_price'];
                 $accessory_org_price = $accessory_price;
                 if ($accessory_price > 0) {
                     $accessory_vat_price = $producthelper->getProductTax($product_id, $accessory_price, $user_id);
                 }
                 $attchildArr = $attArr[$a]['accessory_childs'];
                 for ($j = 0; $j < count($attchildArr); $j++) {
                     $attribute_id = $attchildArr[$j]['attribute_id'];
                     $accessory_attribute .= urldecode($attchildArr[$j]['attribute_name']) . ":<br/>";
                     $rowattitem =& $this->getTable('order_attribute_item');
                     $rowattitem->order_att_item_id = 0;
                     $rowattitem->order_item_id = $rowitem->order_item_id;
                     $rowattitem->section_id = $attribute_id;
                     $rowattitem->section = "attribute";
                     $rowattitem->parent_section_id = $accessory_id;
                     $rowattitem->section_name = $attchildArr[$j]['attribute_name'];
                     $rowattitem->is_accessory_att = 1;
                     if ($attribute_id > 0) {
                         if (!$rowattitem->store()) {
                             $this->setError($this->_db->getErrorMsg());
                             return false;
                         }
                     }
                     $propArr = $attchildArr[$j]['attribute_childs'];
                     for ($k = 0; $k < count($propArr); $k++) {
                         $section_vat = 0;
                         if ($propArr[$k]['property_price'] > 0) {
                             $section_vat = $producthelper->getProducttax($product_id, $propArr[$k]['property_price'], $user_id);
                         }
                         $property_id = $propArr[$k]['property_id'];
                         $accessory_attribute .= urldecode($propArr[$k]['property_name']) . " (" . $propArr[$k]['property_oprand'] . $producthelper->getProductFormattedPrice($propArr[$k]['property_price'] + $section_vat) . ")<br/>";
                         $subpropArr = $propArr[$k]['property_childs'];
                         $rowattitem =& $this->getTable('order_attribute_item');
                         $rowattitem->order_att_item_id = 0;
                         $rowattitem->order_item_id = $rowitem->order_item_id;
                         $rowattitem->section_id = $property_id;
                         $rowattitem->section = "property";
                         $rowattitem->parent_section_id = $attribute_id;
                         $rowattitem->section_name = $propArr[$k]['property_name'];
                         $rowattitem->section_price = $propArr[$k]['property_price'];
                         $rowattitem->section_vat = $section_vat;
                         $rowattitem->section_oprand = $propArr[$k]['property_oprand'];
                         $rowattitem->is_accessory_att = 1;
                         if ($property_id > 0) {
                             if (!$rowattitem->store()) {
                                 $this->setError($this->_db->getErrorMsg());
                                 return false;
                             }
                         }
                         for ($l = 0; $l < count($subpropArr); $l++) {
                             $section_vat = 0;
                             if ($subpropArr[$l]['subproperty_price'] > 0) {
                                 $section_vat = $producthelper->getProducttax($rowitem->product_id, $subpropArr[$l]['subproperty_price'], $user_id);
                             }
                             $subproperty_id = $subpropArr[$l]['subproperty_id'];
                             $accessory_attribute .= urldecode($subpropArr[$l]['subproperty_name']) . " (" . $subpropArr[$l]['subproperty_oprand'] . $producthelper->getProductFormattedPrice($subpropArr[$l]['subproperty_price'] + $section_vat) . ")<br/>";
                             $rowattitem =& $this->getTable('order_attribute_item');
                             $rowattitem->order_att_item_id = 0;
                             $rowattitem->order_item_id = $rowitem->order_item_id;
                             $rowattitem->section_id = $subproperty_id;
                             $rowattitem->section = "subproperty";
                             $rowattitem->parent_section_id = $property_id;
                             $rowattitem->section_name = $subpropArr[$l]['subproperty_name'];
                             $rowattitem->section_price = $subpropArr[$l]['subproperty_price'];
                             $rowattitem->section_vat = $section_vat;
                             $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand'];
                             $rowattitem->is_accessory_att = 1;
                             if ($subproperty_id > 0) {
                                 if (!$rowattitem->store()) {
                                     $this->setError($this->_db->getErrorMsg());
                                     return false;
                                 }
                             }
                         }
                     }
                 }
                 $accdata =& $this->getTable('accessory_detail');
                 if ($accessory_id > 0) {
                     $accdata->load($accessory_id);
                 }
                 $accProductinfo = $producthelper->getProductById($accdata->child_product_id);
                 $rowaccitem =& $this->getTable('order_acc_item');
                 $rowaccitem->order_item_acc_id = 0;
                 $rowaccitem->order_item_id = $rowitem->order_item_id;
                 $rowaccitem->product_id = $accessory_id;
                 $rowaccitem->order_acc_item_sku = $accProductinfo->product_number;
                 $rowaccitem->order_acc_item_name = $accessory_name;
                 $rowaccitem->order_acc_price = $accessory_org_price;
                 $rowaccitem->order_acc_vat = $accessory_vat_price;
                 $rowaccitem->product_quantity = $quantity;
                 $rowaccitem->product_acc_item_price = $accessory_price;
                 $rowaccitem->product_acc_final_price = $accessory_price * $quantity;
                 $rowaccitem->product_attribute = $accessory_attribute;
                 if ($accessory_id > 0) {
                     if (!$rowaccitem->store()) {
                         $this->setError($this->_db->getErrorMsg());
                         return false;
                     }
                 }
             }
         }
         /** my attribute save in table start */
         if (count($generateAttributeCart) > 0) {
             $attArr = $generateAttributeCart;
             for ($j = 0; $j < count($attArr); $j++) {
                 $attribute_id = $attArr[$j]['attribute_id'];
                 $rowattitem =& $this->getTable('order_attribute_item');
                 $rowattitem->order_att_item_id = 0;
                 $rowattitem->order_item_id = $rowitem->order_item_id;
                 $rowattitem->section_id = $attribute_id;
                 $rowattitem->section = "attribute";
                 $rowattitem->parent_section_id = $rowitem->product_id;
                 $rowattitem->section_name = $attArr[$j]['attribute_name'];
                 $rowattitem->is_accessory_att = 0;
                 if ($attribute_id > 0) {
                     if (!$rowattitem->store()) {
                         $this->setError($this->_db->getErrorMsg());
                         return false;
                     }
                 }
                 $propArr = $attArr[$j]['attribute_childs'];
                 for ($k = 0; $k < count($propArr); $k++) {
                     $section_vat = 0;
                     if ($propArr[$k]['property_price'] > 0) {
                         $section_vat = $producthelper->getProducttax($rowitem->product_id, $propArr[$k]['property_price'], $user_id);
                     }
                     $property_id = $propArr[$k]['property_id'];
                     /** product property STOCKROOM update start */
                     $updatestock = $stockroomhelper->updateStockroomQuantity($property_id, $quantity, "property");
                     $rowattitem =& $this->getTable('order_attribute_item');
                     $rowattitem->order_att_item_id = 0;
                     $rowattitem->order_item_id = $rowitem->order_item_id;
                     $rowattitem->section_id = $property_id;
                     $rowattitem->section = "property";
                     $rowattitem->parent_section_id = $attribute_id;
                     $rowattitem->section_name = $propArr[$k]['property_name'];
                     $rowattitem->section_price = $propArr[$k]['property_price'];
                     $rowattitem->section_vat = $section_vat;
                     $rowattitem->section_oprand = $propArr[$k]['property_oprand'];
                     $rowattitem->is_accessory_att = 0;
                     if ($property_id > 0) {
                         if (!$rowattitem->store()) {
                             $this->setError($this->_db->getErrorMsg());
                             return false;
                         }
                     }
                     $subpropArr = $propArr[$k]['property_childs'];
                     for ($l = 0; $l < count($subpropArr); $l++) {
                         $section_vat = 0;
                         if ($subpropArr[$l]['subproperty_price'] > 0) {
                             $section_vat = $producthelper->getProducttax($product_id, $subpropArr[$l]['subproperty_price'], $user_id);
                         }
                         $subproperty_id = $subpropArr[$l]['subproperty_id'];
                         /** product subproperty STOCKROOM update start */
                         $updatestock = $stockroomhelper->updateStockroomQuantity($subproperty_id, $quantity, "subproperty");
                         $rowattitem =& $this->getTable('order_attribute_item');
                         $rowattitem->order_att_item_id = 0;
                         $rowattitem->order_item_id = $rowitem->order_item_id;
                         $rowattitem->section_id = $subproperty_id;
                         $rowattitem->section = "subproperty";
                         $rowattitem->parent_section_id = $property_id;
                         $rowattitem->section_name = $subpropArr[$l]['subproperty_name'];
                         $rowattitem->section_price = $subpropArr[$l]['subproperty_price'];
                         $rowattitem->section_vat = $section_vat;
                         $rowattitem->section_oprand = $subpropArr[$l]['subproperty_oprand'];
                         $rowattitem->is_accessory_att = 0;
                         if ($subproperty_id > 0) {
                             if (!$rowattitem->store()) {
                                 $this->setError($this->_db->getErrorMsg());
                                 return false;
                             }
                         }
                     }
                 }
             }
         }
         //			$producthelper->insertProdcutUserfield($i,$item,$rowitem->order_item_id,12);
         if (USE_CONTAINER) {
             $producthelper->updateContainerStock($product_id, $quantity, $rowitem->container_id);
         }
         // Store userfields
         $userfields = $item[$i]->extrafieldname;
         $userfields_id = $item[$i]->extrafieldId;
         for ($ui = 0; $ui < count($userfields); $ui++) {
             $adminproducthelper->admin_insertProdcutUserfield($userfields_id[$ui], $rowitem->order_item_id, 12, $userfields[$ui]);
         }
         // redCRM RMA Transaction Entry
         if ($iscrm) {
             if (ENABLE_RMA && $rowitem->product_final_price < 0) {
                 // RMA transation log
                 if (isset($item[$i]->reason)) {
                     $rmaTrans =& $this->getTable('rma_transaction');
                     $rmaTrans->rma_transaction_id = 0;
                     $rmaTrans->rma_number = $postdata['rma_number'];
                     $rmaTrans->order_item_return_id = $rowitem->order_item_id;
                     $rmaTrans->order_item_return_reason = $item[$i]->reason;
                     $rmaTrans->order_item_return_status = $item[$i]->deposition;
                     $rmaTrans->order_item_return_action = $item[$i]->action;
                     $rmaTrans->cdate = time();
                     $rmaTrans->store();
                     if (ENABLE_ITEM_TRACKING_SYSTEM) {
                         // Manage supplier order stock
                         $crmSupplierOrderHelper = new crmSupplierOrderHelper();
                         $senddata['main_order_number'] = $postdata['main_order_number'];
                         $senddata['order_status'] = $row->order_status;
                         $senddata['product_id'] = $rowitem->product_id;
                         $senddata['property_id'] = $property_id;
                         $senddata['subproperty_id'] = $subproperty_id;
                         $senddata['deposition'] = $item[$i]->deposition;
                         $itemqty = $rowitem->product_quantity;
                         for ($r = 0; $r < $itemqty; $r++) {
                             $crmSupplierOrderHelper->manageStockAffectedRMA($senddata);
                         }
                     }
                 }
             }
         }
     }
     $rowpayment =& $this->getTable('order_payment');
     if (!$rowpayment->bind($postdata)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $rowpayment->order_id = $row->order_id;
     $rowpayment->payment_method_id = $postdata['payment_method_class'];
     $rowpayment->order_payment_amount = $row->order_total;
     $rowpayment->order_payment_name = $postdata['order_payment_name'];
     $rowpayment->payment_method_class = $postdata['payment_method_class'];
     if (!$rowpayment->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // Add billing Info
     $userrow =& $this->getTable('user_detail');
     $userrow->load($billingaddresses->users_info_id);
     $orderuserrow =& $this->getTable('order_user_detail');
     if (!$orderuserrow->bind($userrow)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $orderuserrow->order_id = $row->order_id;
     $orderuserrow->address_type = 'BT';
     if (!$orderuserrow->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // Add shipping Info
     $userrow =& $this->getTable('user_detail');
     if (isset($shippingaddresses->users_info_id)) {
         $userrow->load($shippingaddresses->users_info_id);
     }
     $orderuserrow =& $this->getTable('order_user_detail');
     if (!$orderuserrow->bind($userrow)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $orderuserrow->order_id = $row->order_id;
     $orderuserrow->address_type = 'ST';
     if (!$orderuserrow->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if ($row->order_status == CLICKATELL_ORDER_STATUS) {
         $helper->clickatellSMS($row->order_id);
     }
     // Maintan supplier order stck when item tracking system is enabled
     if ($helper->isredCRM()) {
         if (ENABLE_ITEM_TRACKING_SYSTEM) {
             // Supplier order helper object
             $crmSupplierOrderHelper = new crmSupplierOrderHelper();
             $getStatus = array();
             $getStatus['orderstatus'] = $row->order_status;
             $getStatus['paymentstatus'] = $row->order_payment_status;
             $crmSupplierOrderHelper->redSHOPOrderUpdate($row->order_id, $getStatus);
             unset($getStatus);
         }
     }
     $checkOrderStatus = 1;
     if ($postdata['payment_method_class'] == "rs_payment_banktransfer" || $postdata['payment_method_class'] == "rs_payment_banktransfer_discount" || $postdata['payment_method_class'] == "rs_payment_banktransfer2" || $postdata['payment_method_class'] == "rs_payment_banktransfer3" || $postdata['payment_method_class'] == "rs_payment_banktransfer4" || $postdata['payment_method_class'] == "rs_payment_banktransfer5") {
         $checkOrderStatus = 0;
     }
     // Economic Integration start for invoice generate and book current invoice
     if (ECONOMIC_INTEGRATION == 1 && ECONOMIC_INVOICE_DRAFT != 2) {
         $issplit = 0;
         $economic = new economic();
         if (isset($postdata['issplit']) && $postdata['issplit'] == 1) {
             $issplit = 1;
         }
         $economicdata['split_payment'] = $issplit;
         $economicdata['economic_payment_terms_id'] = $postdata['economic_payment_terms_id'];
         $economicdata['economic_design_layout'] = $postdata['economic_design_layout'];
         $economicdata['economic_is_creditcard'] = $postdata['economic_is_creditcard'];
         $payment_name = $postdata['payment_method_class'];
         $paymentArr = explode("rs_payment_", $postdata['payment_method_class']);
         if (count($paymentArr) > 0) {
             $payment_name = $paymentArr[1];
         }
         $economicdata['economic_payment_method'] = $payment_name;
         $invoiceHandle = $economic->createInvoiceInEconomic($row->order_id, $economicdata);
         if (ECONOMIC_INVOICE_DRAFT == 0) {
             $bookinvoicepdf = $economic->bookInvoiceInEconomic($row->order_id, $checkOrderStatus);
             if (is_file($bookinvoicepdf)) {
                 $ret = $redshopMail->sendEconomicBookInvoiceMail($row->order_id, $bookinvoicepdf);
             }
         }
     }
     // ORDER MAIL SEND
     if ($postdata['task'] != "save_without_sendmail") {
         $redshopMail->sendOrderMail($row->order_id);
     }
     return $row;
 }
コード例 #18
0
<?php

/**
 * @package     RedSHOP.Backend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
$order_function = new order_functions();
$option = JRequest::getVar('option');
$filter = JRequest::getVar('filter');
$config = new Redconfiguration();
$model = $this->getModel('newslettersubscr');
?>
<script language="javascript" type="text/javascript">

	Joomla.submitbutton = function (pressbutton) {
		submitbutton(pressbutton);
	}
	submitbutton = function (pressbutton) {

		var form = document.adminForm;

		form.task.value = "";
		form.view.value = "newslettersubscr";

		if (pressbutton) {
			form.task.value = pressbutton;
		}
コード例 #19
0
<?php

/**
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
JHTMLBehavior::modal();
$url = JURI::base();
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
$order_function = new order_functions();
$redconfig = new Redconfiguration();
$producthelper = new producthelper();
$carthelper = new rsCarthelper();
$Itemid = JRequest::getInt('Itemid');
$print = JRequest::getInt('print');
$document = JFactory::getDocument();
$redTemplate = new Redtemplate();
$template_id = $this->params->get('template_id');
$orderslist_template = $redTemplate->getTemplate("order_list", $template_id);
if (count($orderslist_template) > 0 && $orderslist_template[0]->template_desc != "") {
    $template_desc = $orderslist_template[0]->template_desc;
} else {
    $template_desc = "<table border=\"0\" cellspacing=\"5\" cellpadding=\"5\" width=\"100%\">\r\n<tbody>\r\n<tr>\r\n<th>{order_id_lbl}</th> <th>{product_name_lbl}</th> <th>{total_price_lbl}</th> <th>{order_date_lbl}</th> <th>{order_date_lbl}</th> <th>{order_detail_lbl}</th>\r\n</tr>\r\n{product_loop_start}       \r\n<tr>\r\n<td>{order_id}</td>\r\n<td>{order_products}</td>\r\n<td>{order_total}</td>\r\n<td>{order_date}</td>\r\n<td>{order_status}</td>\r\n<td>{order_detail_link}</td>\r\n</tr>\r\n{product_loop_end}\r\n</tbody>\r\n</table>\r\n<div>{pagination}</div>";
}
if ($this->params->get('show_page_heading', 1)) {
    ?>
コード例 #20
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $shippinghelper = new shipping();
     $order_functions = new order_functions();
     $params = $app->getParams('com_redshop');
     $option = JRequest::getVar('option');
     $Itemid = JRequest::getInt('Itemid');
     $issplit = JRequest::getBool('issplit');
     $ccinfo = JRequest::getInt('ccinfo');
     $task = JRequest::getCmd('task');
     $model = $this->getModel('checkout');
     $session = JFactory::getSession();
     if ($issplit != '') {
         $session->set('issplit', $issplit);
     }
     $payment_method_id = JRequest::getCmd('payment_method_id');
     $users_info_id = JRequest::getInt('users_info_id');
     $auth = $session->get('auth');
     if (empty($users_info_id)) {
         $users_info_id = $auth['users_info_id'];
     }
     $shipping_rate_id = JRequest::getString('shipping_rate_id');
     $shippingdetail = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $shipping_rate_id)));
     if (count($shippingdetail) < 4) {
         $shipping_rate_id = "";
     }
     $cart = $session->get('cart');
     if ($cart['idx'] < 1) {
         $msg = JText::_('COM_REDSHOP_EMPTY_CART');
         $app->Redirect('index.php?option=' . $option . '&Itemid=' . $Itemid, $msg);
     }
     if (SHIPPING_METHOD_ENABLE) {
         if ($users_info_id < 1) {
             $msg = JText::_('COM_REDSHOP_SELECT_SHIP_ADDRESS');
             $link = 'index.php?option=' . $option . '&view=checkout&Itemid=' . $Itemid . '&users_info_id=' . $users_info_id . '&shipping_rate_id=' . $shipping_rate_id . '&payment_method_id=' . $payment_method_id;
             $app->Redirect($link, $msg);
         }
         if ($shipping_rate_id == '' && $cart['free_shipping'] != 1) {
             $msg = JText::_('COM_REDSHOP_SELECT_SHIP_METHOD');
             $link = 'index.php?option=' . $option . '&view=checkout&Itemid=' . $Itemid . '&users_info_id=' . $users_info_id . '&shipping_rate_id=' . $shipping_rate_id . '&payment_method_id=' . $payment_method_id;
             $app->Redirect($link, $msg);
         }
     }
     if ($payment_method_id == '') {
         $msg = JText::_('COM_REDSHOP_SELECT_PAYMENT_METHOD');
         $link = 'index.php?option=' . $option . '&view=checkout&Itemid=' . $Itemid . '&users_info_id=' . $users_info_id . '&shipping_rate_id=' . $shipping_rate_id . '&payment_method_id=' . $payment_method_id;
         $app->Redirect($link, $msg);
     }
     $paymentinfo = $order_functions->getPaymentMethodInfo($payment_method_id);
     $paymentinfo = $paymentinfo[0];
     $paymentpath = JPATH_SITE . '/plugins/redshop_payment/' . $paymentinfo->element . '/' . $paymentinfo->element . '.xml';
     $paymentparams = new JRegistry($paymentinfo->params);
     $is_creditcard = $paymentparams->get('is_creditcard', '');
     $is_subscription = $paymentparams->get('is_subscription', 0);
     if (@$is_creditcard == 1) {
         $document = JFactory::getDocument();
         JHTML::Script('credit_card.js', 'components/com_redshop/assets/js/', false);
     }
     if ($is_subscription) {
         $subscription_id = $session->set('subscription_id', $subscription_id);
     }
     $this->cart = $cart;
     $this->users_info_id = $users_info_id;
     $this->shipping_rate_id = $shipping_rate_id;
     $this->payment_method_id = $payment_method_id;
     $this->is_creditcard = $is_creditcard;
     if ($task != '') {
         $tpl = $task;
     }
     parent::display($tpl);
 }
コード例 #21
0
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
$model = $this->getModel('checkout');
$uri = JURI::getInstance();
$url = $uri->root();
$redhelper = new redhelper();
$Itemid = $redhelper->getCheckoutItemid();
if ($Itemid == 0) {
    $Itemid = JRequest::getInt('Itemid');
}
$session = JFactory::getSession();
$order_functions = new order_functions();
$extra_field = new extra_field();
$billingaddresses = $model->billingaddresses();
?>
<table class="admintable">
	<?php 
if ($billingaddresses->is_company == 1) {
    ?>
		<tr>
			<td width="100" align="left"><label><?php 
    echo JText::_('COM_REDSHOP_COMPANY_NAME');
    ?>
:</label></td>
			<td><?php 
    echo $billingaddresses->company_name;
    ?>
コード例 #22
0
 public function save($apply = 0)
 {
     $post = JRequest::get('post');
     $adminproducthelper = new adminproducthelper();
     $order_functions = new order_functions();
     $shippinghelper = new shipping();
     $option = JRequest::getVar('option', '', 'request', 'string');
     $cid = JRequest::getVar('cid', array(0), 'post', 'array');
     $post['order_id'] = $cid[0];
     $model = $this->getModel('addorder_detail');
     $post['order_number'] = $order_number = $order_functions->generateOrderNumber();
     $orderItem = $adminproducthelper->redesignProductItem($post);
     $post['order_item'] = $orderItem;
     // Check product Quantity
     $stocknote = '';
     if (USE_STOCKROOM == 1) {
         $stockroomhelper = new rsstockroomhelper();
         $producthelper = new producthelper();
         for ($i = 0; $i < count($orderItem); $i++) {
             $quantity = $orderItem[$i]->quantity;
             $productData = $producthelper->getProductById($orderItem[$i]->product_id);
             if ($productData->min_order_product_quantity > 0 && $productData->min_order_product_quantity > $quantity) {
                 $msg = $productData->product_name . " " . JText::_('WARNING_MSG_MINIMUM_QUANTITY');
                 $stocknote .= sprintf($msg, $productData->min_order_product_quantity) . "<br/>";
                 $quantity = $productData->min_order_product_quantity;
             }
             $currentStock = $stockroomhelper->getStockroomTotalAmount($orderItem[$i]->product_id);
             $finalquantity = $currentStock >= $quantity ? (int) $quantity : (int) $currentStock;
             if ($finalquantity > 0) {
                 if ($productData->max_order_product_quantity > 0 && $productData->max_order_product_quantity < $finalquantity) {
                     $msg = $productData->product_name . " " . JText::_('WARNING_MSG_MAXIMUM_QUANTITY') . "<br/>";
                     $stocknote .= sprintf($msg, $productData->max_order_product_quantity);
                     $finalquantity = $productData->max_order_product_quantity;
                 }
                 $orderItem[$i]->quantity = $finalquantity;
             } else {
                 $stocknote .= $productData->product_name . " " . JText::_('PRODUCT_OUT_OF_STOCK') . "<br/>";
                 unset($orderItem[$i]);
             }
         }
         $orderItem = array_merge(array(), $orderItem);
         if (count($orderItem) <= 0) {
             $msg = JText::_('PRODUCT_OUT_OF_STOCK');
             $this->setRedirect('index.php?option=' . $option . '&view=addorder_detail&user_id=' . $post['user_id'] . '&shipping_users_info_id=' . $post['shipp_users_info_id'], $msg);
             return;
         }
     }
     $order_total = $post['order_total'];
     $order_shipping = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $post['shipping_rate_id'])));
     if (count($order_shipping) > 4) {
         $post['order_shipping'] = $order_shipping[3];
         $order_total = $order_total + $order_shipping[3];
         $post['order_shipping_tax'] = $order_shipping[6];
     }
     $tmporder_total = $order_total;
     if (array_key_exists("issplit", $post) && $post['issplit']) {
         $tmporder_total = $order_total / 2;
     }
     $paymentmethod = $order_functions->getPaymentMethodInfo($post['payment_method_class']);
     $paymentmethod = $paymentmethod[0];
     $paymentparams = new JRegistry($paymentmethod->params);
     $paymentinfo = new stdclass();
     $post['economic_payment_terms_id'] = $paymentparams->get('economic_payment_terms_id');
     $post['economic_design_layout'] = $paymentparams->get('economic_design_layout');
     $paymentinfo->payment_price = $paymentparams->get('payment_price', '');
     $paymentinfo->is_creditcard = $post['economic_is_creditcard'] = $paymentparams->get('is_creditcard', '');
     $paymentinfo->payment_oprand = $paymentparams->get('payment_oprand', '');
     $paymentinfo->accepted_credict_card = $paymentparams->get("accepted_credict_card");
     $paymentinfo->payment_discount_is_percent = $paymentparams->get('payment_discount_is_percent', '');
     $cartHelper = new rsCartHelper();
     $subtotal = $post['order_subtotal'];
     $update_discount = 0;
     if ($post['update_discount'] > 0) {
         $update_discount = $post['update_discount'];
         if ($update_discount > $subtotal) {
             $update_discount = $subtotal;
         }
         if ($update_discount != 0) {
             $order_total = $order_total - $update_discount;
         }
     }
     $special_discount = $post['special_discount'];
     $subtotal_excl_vat = 0;
     for ($i = 0; $i < count($orderItem); $i++) {
         $subtotal_excl_vat = $subtotal_excl_vat + $orderItem[$i]->prdexclprice * $orderItem[$i]->quantity;
     }
     if (APPLY_VAT_ON_DISCOUNT) {
         $amt = $subtotal;
     } else {
         $amt = $subtotal_excl_vat;
     }
     $discount_price = $amt * $special_discount / 100;
     $post['special_discount'] = $special_discount;
     $post['special_discount_amount'] = $discount_price;
     $order_total = $order_total - $discount_price;
     if (PAYMENT_CALCULATION_ON == 'subtotal') {
         $paymentAmount = $subtotal;
     } else {
         $paymentAmount = $order_total;
     }
     $paymentMethod = $cartHelper->calculatePayment($paymentAmount, $paymentinfo, $order_total);
     $post['ship_method_id'] = urldecode(urldecode($post['shipping_rate_id']));
     $order_total = $paymentMethod[0];
     $post['user_info_id'] = $post['users_info_id'];
     $post['payment_discount'] = $paymentMethod[1];
     $post['payment_oprand'] = $paymentinfo->payment_oprand;
     $post['order_discount'] = $update_discount;
     $post['order_total'] = $order_total;
     $post['order_payment_amount'] = $tmporder_total;
     $post['order_payment_name'] = $paymentmethod->name;
     if ($apply == 1) {
         $post['order_payment_status'] = 'Unpaid';
         $post['order_status'] = 'P';
     }
     if ($row = $model->store($post)) {
         $msg = JText::_('COM_REDSHOP_ORDER_DETAIL_SAVED');
     } else {
         $msg = JText::_('COM_REDSHOP_ERROR_SAVING_ORDER_DETAIL');
     }
     if ($apply == 1) {
         $objorder = new order_functions();
         $objorder->getpaymentinformation($row, $post);
     } else {
         $this->setRedirect('index.php?option=' . $option . '&view=order', $msg . $stocknote);
     }
 }
コード例 #23
0
    function display($tpl = null)
    {
        $config = new Redconfiguration();
        $redTemplate = new Redtemplate();
        $order_functions = new order_functions();
        $producthelper = new producthelper();
        $model = $this->getModel();
        $redTemplate = new Redtemplate();
        $detail = $this->get('data');
        $carthelper = new rsCarthelper();
        $shippinghelper = new shipping();
        $products = $order_functions->getOrderItemDetail($detail->order_id);
        $template = $model->getStockNoteTemplate();
        if (count($template) > 0 && $template->template_desc != "") {
            $html_template = $template->template_desc;
        } else {
            $html_template = '<table border="0" cellspacing="2" cellpadding="2" width="100%"><tr><td>{order_id_lbl} : {order_id}</td><td> {order_date_lbl} : {order_date}</td></tr></table>
                       <table border="1" cellspacing="0" cellpadding="0" width="100%"><tbody><tr style="background-color: #d7d7d4"><th align="center">{product_name_lbl}</th> <th align="center">{product_number_lbl}</th> <th align="center">{product_quantity_lbl}</th></tr>
						{product_loop_start}
						<tr>
						<td  align="center">
							<table>
							<tr><td>{product_name}</td></tr>
							<tr><td>{product_attribute}</td></tr>
							</table>
						</td>
						<td  align="center">{product_number}</td>
						<td  align="center">{product_quantity}</td>
						</tr>
						{product_loop_end}
						</tbody>
						</table>';
        }
        ob_start();
        if (strstr($html_template, "{product_loop_start}") && strstr($html_template, "{product_loop_end}")) {
            $template_sdata = explode('{product_loop_start}', $html_template);
            $template_start = $template_sdata[0];
            $template_edata = explode('{product_loop_end}', $template_sdata[1]);
            $template_end = $template_edata[1];
            $template_middle = $template_edata[0];
            $middle_data = '';
            for ($p = 0; $p < count($products); $p++) {
                $middle_data .= $template_middle;
                $product_detail = $producthelper->getProductById($products[$p]->product_id);
                $middle_data = str_replace("{product_number}", $product_detail->product_number, $middle_data);
                $middle_data = str_replace("{product_name}", $products[$p]->order_item_name, $middle_data);
                $middle_data = str_replace("{product_attribute}", $products[$p]->product_attribute, $middle_data);
                $middle_data = str_replace("{product_quantity}", $products[$p]->product_quantity, $middle_data);
            }
            $html_template = $template_start . $middle_data . $template_end;
        }
        $html_template = str_replace("{order_id_lbl}", JText::_('COM_REDSHOP_ORDER_ID'), $html_template);
        $html_template = str_replace("{order_id}", $detail->order_id, $html_template);
        $html_template = str_replace("{order_date_lbl}", JText::_('COM_REDSHOP_ORDER_DATE'), $html_template);
        $html_template = str_replace("{order_date}", $config->convertDateFormat($detail->cdate), $html_template);
        $html_template = str_replace("{product_name_lbl}", JText::_('COM_REDSHOP_PRODUCT_NAME'), $html_template);
        $html_template = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER'), $html_template);
        $html_template = str_replace("{product_quantity_lbl}", JText::_('COM_REDSHOP_QUANTITY'), $html_template);
        $billing = $order_functions->getOrderBillingUserInfo($detail->order_id);
        $html_template = $carthelper->replaceBillingAddress($html_template, $billing);
        $shipping = $order_functions->getOrderShippingUserInfo($detail->order_id);
        $html_template = $carthelper->replaceShippingAddress($html_template, $shipping);
        $html_template = str_replace("{requisition_number}", $detail->requisition_number, $html_template);
        $html_template = str_replace("{requisition_number_lbl}", JText::_('COM_REDSHOP_REQUISITION_NUMBER'), $html_template);
        // start pdf code
        $pdfObj = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A5', true, 'UTF-8', false);
        $pdfObj->SetTitle("Order StockNote: " . $detail->order_id);
        $pdfObj->SetAuthor('redSHOP');
        $pdfObj->SetCreator('redSHOP');
        $pdfObj->SetMargins(15, 15, 15);
        $font = 'times';
        $pdfObj->SetHeaderData('', '', '', "Order " . $detail->order_id);
        $pdfObj->setHeaderFont(array($font, '', 10));
        //$pdfObj->setFooterFont(array($font, '', 8));
        $pdfObj->SetFont($font, "", 10);
        //$pdfObj->AliasNbPages();
        $pdfObj->AddPage();
        $pdfObj->WriteHTML($html_template);
        $pdfObj->Output("StocNoteOrder_" . $detail->order_id . ".pdf", "D");
        exit;
    }
コード例 #24
0
<?php

/**
 * @package     RedSHOP.Backend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
require_once JPATH_COMPONENT_SITE . '/helpers/product.php';
$producthelper = new producthelper();
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
$order_functions = new order_functions();
$option = JRequest::getVar('option');
$model = $this->getModel('coupon');
$url = JUri::base();
$comment = JRequest::getVar('filter');
?>
<script language="javascript" type="text/javascript">

	Joomla.submitbutton = function (pressbutton) {
		submitbutton(pressbutton);
	}
	submitbutton = function (pressbutton) {
		var form = document.adminForm;
		if (pressbutton) {
			form.task.value = pressbutton;
		}

		if ((pressbutton == 'add') || (pressbutton == 'edit') || (pressbutton == 'publish') || (pressbutton == 'unpublish')
			|| (pressbutton == 'remove')) {
コード例 #25
0
ファイル: order.php プロジェクト: jaanusnurmoja/redjoomla
 public function business_gls_export($cid)
 {
     $app = JFactory::getApplication();
     $oids = implode(',', $cid);
     $where = "";
     $redhelper = new redhelper();
     $order_helper = new order_functions();
     $shipping = new shipping();
     $exportfilename = 'redshop_gls_order_export.csv';
     /* Start output to the browser */
     if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) {
         $UserBrowser = "Opera";
     } elseif (ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) {
         $UserBrowser = "IE";
     } else {
         $UserBrowser = '';
     }
     $mime_type = $UserBrowser == 'IE' || $UserBrowser == 'Opera' ? 'application/octetstream' : 'application/octet-stream';
     /* Clean the buffer */
     while (@ob_end_clean()) {
     }
     header('Content-Type: ' . $mime_type);
     header('Content-Encoding: UTF-8');
     header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     if ($UserBrowser == 'IE') {
         header('Content-Disposition: inline; filename="' . $exportfilename . '"');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Pragma: public');
     } else {
         header('Content-Disposition: attachment; filename="' . $exportfilename . '"');
         header('Pragma: no-cache');
     }
     if ($cid[0] != 0) {
         $where = " WHERE order_id IN (" . $oids . ")";
     }
     $db = JFactory::getDbo();
     $q = "SELECT * FROM #__redshop_orders " . $where . " ORDER BY order_id asc";
     $db->setQuery($q);
     $gls_arr = $db->loadObjectList();
     echo "Order_number,Quantity,Create_date,total_weight,reciever_firstName,reciever_lastname,Customer_note";
     echo "\r\n";
     for ($i = 0; $i < count($gls_arr); $i++) {
         $details = explode("|", $shipping->decryptShipping(str_replace(" ", "+", $gls_arr[$i]->ship_method_id)));
         if ($details[0] == 'shipper') {
             $orderproducts = $order_helper->getOrderItemDetail($gls_arr[$i]->order_id);
             $shippingDetails = $order_helper->getOrderShippingUserInfo($gls_arr[$i]->order_id);
             $billingDetails = $order_helper->getOrderBillingUserInfo($gls_arr[$i]->order_id);
             $totalWeight = "";
             $qty = "";
             for ($c = 0; $c < count($orderproducts); $c++) {
                 $product_id[] = $orderproducts[$c]->product_id;
                 $qty += $orderproducts[$c]->product_quantity;
                 $content_products[] = $orderproducts[$c]->order_item_name;
                 $sql = "SELECT weight FROM #__redshop_product WHERE product_id ='" . $orderproducts[$c]->product_id . "'";
                 $db->setQuery($sql);
                 $weight = $db->loadResult();
                 $totalWeight += $weight * $orderproducts[$c]->product_quantity;
             }
             $userDetail = ',"' . $shippingDetails->firstname . ' ' . $shippingDetails->lastname . '","' . $gls_arr[$i]->customer_note;
             echo '"' . $gls_arr[$i]->order_number . '","' . $qty . '","' . date("d-m-Y", $gls_arr[$i]->cdate) . '","' . $totalWeight . '","' . $userDetail . '"';
             echo "\r\n";
         }
     }
     exit;
 }
コード例 #26
0
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
$uri = JURI::getInstance();
$url = JURI::base();
$redconfig = new Redconfiguration();
$extra_field = new extra_field();
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/shipping.php';
require_once JPATH_COMPONENT . '/helpers/product.php';
require_once JPATH_COMPONENT . '/helpers/helper.php';
require_once JPATH_COMPONENT . '/helpers/cart.php';
$producthelper = new producthelper();
$redhelper = new redhelper();
$order_functions = new order_functions();
$redTemplate = new Redtemplate();
$shippinghelper = new shipping();
$carthelper = new rsCarthelper();
$Itemid = JRequest::getInt('Itemid');
$oid = JRequest::getInt('oid');
$print = JRequest::getInt('print');
$getshm = $uri->getScheme();
$config = JFactory::getConfig();
$force_ssl = $config->getValue('force_ssl');
if ($getshm == 'https' && $force_ssl > 2) {
    $uri->setScheme('http');
}
?>
	<script type="text/javascript">
		function submitReorder() {
コード例 #27
0
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
JHTML::_('behavior.tooltip');
JHTML::_('behavior.modal');
require_once JPATH_COMPONENT_SITE . '/helpers/product.php';
require_once JPATH_COMPONENT_SITE . '/helpers/helper.php';
require_once JPATH_COMPONENT_SITE . '/helpers/cart.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/shipping.php';
$producthelper = new producthelper();
$carthelper = new rsCarthelper();
$order_functions = new order_functions();
$redhelper = new redhelper();
$extra_field = new extra_field();
$shippinghelper = new shipping();
$config = new Redconfiguration();
$uri = JURI::getInstance();
$url = $uri->root();
$option = JRequest::getVar('option');
$tmpl = JRequest::getVar('tmpl');
$model = $this->getModel('order_detail');
$session = JFactory::getSession();
$billing = $this->billing;
$shipping = $this->shipping;
$is_company = $billing->is_company;
$order_id = $this->detail->order_id;
$products = $order_functions->getOrderItemDetail($order_id);
コード例 #28
0
ファイル: view.html.php プロジェクト: jaanusnurmoja/redjoomla
 public function display($tpl = null)
 {
     $option = JRequest::getVar('option');
     $extra_field = new extra_field();
     $order_functions = new order_functions();
     $Redconfiguration = new Redconfiguration();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSHOP_ORDER'));
     $document->addScript('components/' . $option . '/assets/js/select_sort.js');
     $document->addStyleSheet('components/' . $option . '/assets/css/search.css');
     $document->addScript('components/' . $option . '/assets/js/search.js');
     $document->addScript('components/' . $option . '/assets/js/json.js');
     $document->addScript('components/' . $option . '/assets/js/validation.js');
     $document->addScript('components/' . $option . '/assets/js/order.js');
     $document->addScript('components/' . $option . '/assets/js/common.js');
     $uri = JFactory::getURI();
     $lists = array();
     $billing = array();
     $shippinginfo = array();
     $model = $this->getModel();
     $detail = $this->get('data');
     $redhelper = new redhelper();
     $payment_lang_list = $redhelper->getPlugins("redshop_payment");
     $language = JFactory::getLanguage();
     $base_dir = JPATH_ADMINISTRATOR;
     $language_tag = $language->getTag();
     for ($l = 0; $l < count($payment_lang_list); $l++) {
         $extension = 'plg_redshop_payment_' . $payment_lang_list[$l]->element;
         $language->load($extension, $base_dir, $language_tag, true);
     }
     $err = JRequest::getVar('err', '');
     $shipping_rate_id = JRequest::getVar('shipping_rate_id');
     $user_id = JRequest::getVar('user_id', 0);
     if ($user_id != 0) {
         $billing = $order_functions->getBillingAddress($user_id);
         $shippinginfo = $order_functions->getShippingAddress($user_id);
     } else {
         $billing = $model->setBilling();
     }
     $shipping_country = 0;
     $shipping_state = 0;
     $key = 0;
     $shippingop = array();
     $shippingop[0] = new stdClass();
     $shippingop[0]->users_info_id = 0;
     $shippingop[0]->text = JText::_('COM_REDSHOP_SELECT');
     if (count($shippinginfo) > 0) {
         $shipping_users_info_id = JRequest::getVar('shipping_users_info_id', 0);
         if ($shipping_users_info_id != 0) {
             for ($o = 0; $o < count($shippinginfo); $o++) {
                 if ($shippinginfo[$o]->users_info_id == $shipping_users_info_id) {
                     $key = $o;
                     break;
                 }
             }
             $shipping_country = $shippinginfo[$key]->country_code;
             $shipping_state = $shippinginfo[$key]->state_code;
         }
         $shippingop = array_merge($shippingop, $shippinginfo);
         $billisship = $shippinginfo[$key]->billisship = $shipping_users_info_id ? 0 : 1;
     } else {
         $shippinginfo[0] = $model->setShipping();
         $shipping_users_info_id = $shippinginfo[0]->users_info_id = 0;
         $billisship = $shippinginfo[0]->billisship;
     }
     $shdisable = $billisship ? "disabled" : "";
     $detail->user_id = $user_id;
     $lists['shippinginfo_list'] = JHTML::_('select.genericlist', $shippingop, 'shipp_users_info_id', 'class="inputbox" ' . $shdisable . ' onchange="getShippinginfo(this.value, ' . $billing->is_company . ');" ', 'users_info_id', 'text', $shipping_users_info_id);
     $payment_detail = $this->get('payment');
     JToolBarHelper::title(JText::_('COM_REDSHOP_ORDER') . ': <small><small>[ ' . JText::_('COM_REDSHOP_NEW') . ' ]</small></small>', 'redshop_order48');
     if ($err == "" && array_key_exists("users_info_id", $billing) && $billing->users_info_id) {
         JToolBarHelper::custom('savepay', 'save.png', 'save_f2.png', 'Save + Pay', false);
         JToolBarHelper::custom('save_without_sendmail', 'save.png', 'save_f2.png', JText::_('COM_REDSHOP_SAVE_WITHOUT_SEND_ORDERMAIL_LBL'), false);
         JToolBarHelper::save();
     }
     JToolBarHelper::cancel();
     $countryarray = $Redconfiguration->getCountryList((array) $billing, "country_code", "BT");
     $billing->country_code = $countryarray['country_code'];
     $lists['country_code'] = $countryarray['country_dropdown'];
     $statearray = $Redconfiguration->getStateList((array) $billing, "state_code", "country_code", "BT", 1);
     $lists['state_code'] = $statearray['state_dropdown'];
     $shipping['country_code_ST'] = $shippinginfo[$key]->country_code;
     $countryarray = $Redconfiguration->getCountryList((array) $shipping, "country_code_ST", "ST");
     $shipping['country_code_ST'] = $shippinginfo[$key]->country_code = $countryarray['country_code_ST'];
     $lists['country_code_ST'] = $countryarray['country_dropdown'];
     $statearray = $Redconfiguration->getStateList((array) $shipping, "state_code_ST", "country_code_ST", "ST", 1);
     $lists['state_code_ST'] = $statearray['state_dropdown'];
     $lists['is_company'] = JHTML::_('select.booleanlist', 'is_company', 'class="inputbox" onchange="showOfflineCompanyOrCustomer(this.value);" ', $billing->is_company, JText::_('COM_REDSHOP_USER_COMPANY'), JText::_('COM_REDSHOP_USER_CUSTOMER'));
     $lists['customer_field'] = $extra_field->list_all_field(7, $billing->users_info_id);
     $lists['company_field'] = $extra_field->list_all_field(8, $billing->users_info_id);
     $lists['shipping_customer_field'] = $extra_field->list_all_field(14, $shippinginfo[0]->users_info_id);
     $lists['shipping_company_field'] = $extra_field->list_all_field(15, $shippinginfo[0]->users_info_id);
     $this->lists = $lists;
     $this->detail = $detail;
     $this->billing = $billing;
     $this->shipping = $shippinginfo[$key];
     $this->shipping_users_info_id = $shipping_users_info_id;
     $this->payment_detail = $payment_detail;
     $this->shipping_rate_id = $shipping_rate_id;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
コード例 #29
0
 public function makeAttributeOrder($order_item_id = 0, $is_accessory = 0, $parent_section_id = 0, $stock = 0, $export = 0, $data = '')
 {
     $stockroomhelper = new rsstockroomhelper();
     $order_functions = new order_functions();
     $displayattribute = "";
     $chktag = $this->getApplyattributeVatOrNot($data);
     $product_attribute = "";
     $quantity = 0;
     $stockroom_id = "0";
     $orderItemdata = $order_functions->getOrderItemDetail(0, 0, $order_item_id);
     $products = $this->getProductById($orderItemdata[0]->product_id);
     if (count($orderItemdata) > 0 && $is_accessory != 1) {
         $product_attribute = $orderItemdata[0]->product_attribute;
         $quantity = $orderItemdata[0]->product_quantity;
         $stockroom_id = $orderItemdata[0]->stockroom_id;
     }
     $orderItemAttdata = $order_functions->getOrderItemAttributeDetail($order_item_id, $is_accessory, "attribute", $parent_section_id);
     // Get Attribute middle template
     $attribute_middle_template = $this->getAttributeTemplateLoop($data);
     $attribute_final_template = '';
     if (count($orderItemAttdata) > 0) {
         for ($i = 0; $i < count($orderItemAttdata); $i++) {
             $attribute = $this->getProductAttribute(0, 0, $orderItemAttdata[$i]->section_id);
             $hide_attribute_price = 0;
             if (count($attribute) > 0) {
                 $hide_attribute_price = $attribute[0]->hide_attribute_price;
             }
             if (!strstr($data, '{remove_product_attribute_title}')) {
                 $displayattribute .= "<div class='checkout_attribute_title'>" . urldecode($orderItemAttdata[$i]->section_name) . "</div>";
             }
             // Assign Attribute middle template in tmp variable
             $tmp_attribute_middle_template = $attribute_middle_template;
             $tmp_attribute_middle_template = str_replace("{product_attribute_name}", urldecode($orderItemAttdata[$i]->section_name), $tmp_attribute_middle_template);
             $orderPropdata = $order_functions->getOrderItemAttributeDetail($order_item_id, $is_accessory, "property", $orderItemAttdata[$i]->section_id);
             for ($p = 0; $p < count($orderPropdata); $p++) {
                 $property_price = $orderPropdata[$p]->section_price;
                 if ($stock == 1) {
                     $stockroomhelper->manageStockAmount($orderPropdata[$p]->section_id, $quantity, $orderPropdata[$p]->stockroom_id, "property");
                 }
                 $property = $this->getAttibuteProperty($orderPropdata[$p]->section_id);
                 $virtualNumber = "";
                 if (count($property) > 0 && $property[0]->property_number) {
                     $virtualNumber = "<div class='checkout_attribute_number'>" . $property[0]->property_number . "</div>";
                 }
                 if (!empty($chktag)) {
                     $property_price = $orderPropdata[$p]->section_price + $orderPropdata[$p]->section_vat;
                 }
                 if ($export == 1) {
                     $disPrice = " (" . $orderPropdata[$p]->section_oprand . REDCURRENCY_SYMBOL . $property_price . ")";
                 } else {
                     $disPrice = "";
                     if (!$hide_attribute_price) {
                         $disPrice = " (" . $orderPropdata[$p]->section_oprand . $this->getProductFormattedPrice($property_price) . ")";
                     }
                     if (!strstr($data, '{product_attribute_price}')) {
                         $disPrice = '';
                     }
                     if (!strstr($data, '{product_attribute_number}')) {
                         $virtualNumber = '';
                     }
                 }
                 $displayattribute .= "<div class='checkout_attribute_wrapper'><div class='checkout_attribute_price'>" . urldecode($orderPropdata[$p]->section_name) . $disPrice . "</div>" . $virtualNumber . "</div>";
                 // Replace attribute property price and value
                 $tmp_attribute_middle_template = str_replace("{product_attribute_value}", urldecode($orderPropdata[$p]->section_name), $tmp_attribute_middle_template);
                 $tmp_attribute_middle_template = str_replace("{product_attribute_value_price}", $disPrice, $tmp_attribute_middle_template);
                 // Assign tmp variable to looping variable to get copy of all texts
                 $attribute_final_template .= $tmp_attribute_middle_template;
                 $orderSubpropdata = $order_functions->getOrderItemAttributeDetail($order_item_id, $is_accessory, "subproperty", $orderPropdata[$p]->section_id);
                 for ($sp = 0; $sp < count($orderSubpropdata); $sp++) {
                     $subproperty_price = $orderSubpropdata[$sp]->section_price;
                     if ($stock == 1) {
                         $stockroomhelper->manageStockAmount($orderSubpropdata[$sp]->section_id, $quantity, $orderSubpropdata[$sp]->stockroom_id, "subproperty");
                     }
                     $subproperty = $this->getAttibuteSubProperty($orderSubpropdata[$sp]->section_id);
                     $virtualNumber = "";
                     if (count($subproperty) > 0 && $subproperty[0]->subattribute_color_number) {
                         $virtualNumber = "<div class='checkout_subattribute_number'>[" . $subproperty[0]->subattribute_color_number . "]</div>";
                     }
                     if (!empty($chktag)) {
                         $subproperty_price = $orderSubpropdata[$sp]->section_price + $orderSubpropdata[$sp]->section_vat;
                     }
                     if ($export == 1) {
                         $disPrice = " (" . $orderSubpropdata[$sp]->section_oprand . REDCURRENCY_SYMBOL . $subproperty_price . ")";
                     } else {
                         $disPrice = "";
                         if (!$hide_attribute_price) {
                             $disPrice = " (" . $orderSubpropdata[$sp]->section_oprand . $this->getProductFormattedPrice($subproperty_price) . ")";
                         }
                         if (!strstr($data, '{product_attribute_price}')) {
                             $disPrice = '';
                         }
                         if (!strstr($data, '{product_attribute_number}')) {
                             $virtualNumber = '';
                         }
                     }
                     if (!strstr($data, '{remove_product_subattribute_title}')) {
                         $displayattribute .= "<div class='checkout_subattribute_title'>" . urldecode($subproperty[0]->subattribute_color_title) . " : </div>";
                     }
                     $displayattribute .= "<div class='checkout_subattribute_wrapper'><div class='checkout_subattribute_price'>" . urldecode($orderSubpropdata[$sp]->section_name) . $disPrice . "</div>" . $virtualNumber . "</div>";
                 }
             }
         }
     } else {
         $displayattribute = $product_attribute;
     }
     if ($products->use_discount_calc == 1) {
         $displayattribute = $displayattribute . $orderItemdata[0]->discount_calc_data;
     }
     $data = new stdClass();
     $data->product_attribute = $displayattribute;
     $data->attribute_middle_template = $attribute_final_template;
     $data->attribute_middle_template_core = $attribute_middle_template;
     return $data;
 }
コード例 #30
0
 * @package     RedSHOP.Frontend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('_JEXEC') or die;
$url = JURI::base();
include_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/order.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/quotation.php';
include_once JPATH_COMPONENT . '/helpers/product.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/extra_field.php';
require_once JPATH_COMPONENT . '/helpers/extra_field.php';
$producthelper = new producthelper();
$quotationHelper = new quotationHelper();
$order_functions = new order_functions();
$configobj = new Redconfiguration();
$redTemplate = new Redtemplate();
$extra_field = new extra_field();
$extraField = new extraField();
$carthelper = new rsCarthelper();
$user = JFactory::getUser();
$Itemid = JRequest::getInt('Itemid');
$app = JFactory::getApplication();
$params = $app->getParams('com_redshop');
$returnitemid = $params->get('logout', $Itemid);
$accountbillto_link = JRoute::_("index.php?option=com_redshop&view=account_billto&Itemid=" . $Itemid);
$accountshipto_link = JRoute::_("index.php?option=com_redshop&view=account_shipto&Itemid=" . $Itemid);
$logout_link = JRoute::_("index.php?option=com_redshop&view=login&task=logout&logout=" . $returnitemid . "&Itemid=" . $Itemid);
$compare_link = JRoute::_("index.php?option=com_redshop&view=product&layout=compare&Itemid=" . $Itemid);
$mytags_link = JRoute::_("index.php?option=com_redshop&view=account&layout=mytags&Itemid=" . $Itemid);