コード例 #1
0
ファイル: filesmanager.php プロジェクト: Eximagen/3m
 public function initContent()
 {
     $module = new orderfiles();
     $this->var = $module->getconf();
     parent::initContent();
     global $smarty;
     $ext = explode(",", Configuration::get('OF_FTYPES'));
     $smarty->assign('extensions', $ext);
     if (isset($_POST['addfile'])) {
         if (isset($_POST['oid'])) {
             $order = new OrderCore($_POST['oid']);
             if ($order->id_customer == $this->context->customer->id) {
                 $this->insertphoto($_POST, $_FILES);
             }
         }
     }
     if (isset($_POST['savefile'])) {
         if ($_POST['pty'] == "order") {
             $module->updatefileorder($_POST['fid'], mysql_escape_string($_POST['description']), mysql_escape_string($_POST['title']));
         }
         if ($_POST['pty'] == "cart") {
             $module->updatefilecart($_POST['fid'], mysql_escape_string($_POST['description']), mysql_escape_string($_POST['title']));
         }
         if ($_POST['pty'] == "product") {
             $module->updatefileproduct($_POST['fid'], mysql_escape_string($_POST['description']), mysql_escape_string($_POST['title']));
         }
     }
     if (isset($_POST['delfile'])) {
         if (isset($_POST['oid'])) {
             $order = new OrderCore($_POST['oid']);
             if ($order->id_customer == $this->context->customer->id) {
                 $this->photodelete($_POST['fid'], $this->context->customer->id);
             }
         }
     }
     if (isset($_POST['delcartfile'])) {
         if (isset($_POST['fid'])) {
             $this->cartfiledelete($_POST['fid']);
         }
     }
     if (isset($_POST['delproductfile'])) {
         if (isset($_POST['fid'])) {
             $this->productfiledelete($_POST['fid']);
         }
     }
     if (isset($_POST['oid'])) {
         $order = new OrderCore($_POST['oid']);
         if ($order->id_customer == $this->context->customer->id) {
             $this->context->smarty->assign(array('mod' => $this, 'setup' => $this->var, 'order' => $order, 'idorder' => $_POST['oid'], 'files' => $this->get_files($_POST['oid'], $this->context->customer->id), 'link' => $this->context->link, 'customer' => $this->context->customer));
             $this->setTemplate('filesmanager.tpl');
         } else {
             $this->setTemplate('access-denied.tpl');
         }
     } else {
         $this->setTemplate('access-denied.tpl');
     }
 }
コード例 #2
0
ファイル: myfiles.php プロジェクト: Eximagen/3m
 public function initContent()
 {
     $module = new orderfiles();
     $this->var = $module->getconf();
     parent::initContent();
     $order = new OrderCore();
     $custorders = $order->getCustomerOrders($this->context->customer->id);
     $this->context->smarty->assign(array('mod' => $this, 'setup' => $this->var, 'orders' => $custorders, 'link' => $this->context->link, 'psversion' => $module->psversion(), 'customer' => $this->context->customer));
     $this->setTemplate('my-files.tpl');
 }
コード例 #3
0
ファイル: orderfilestab14.php プロジェクト: Eximagen/3m
 public function __construct()
 {
     $module = new orderfiles();
     if ($module->psversion() == 5) {
         $this->context = Context::getContext();
         $this->multishop_context = $this->context->shop->id;
         $this->multishop_context_group = $this->context->shop->id_shop_group;
     }
     $this->orderfiles = new orderfiles();
     return parent::__construct();
 }
コード例 #4
0
ファイル: customquote.php プロジェクト: Eximagen/3m
 public function hookdisplayProductcustomquote($params)
 {
     global $cookie;
     if (isset($_COOKIE['ftpr'])) {
         $cookieid = $_COOKIE['ftpr'];
     } else {
         $cookieid = 'x';
     }
     $this->context->controller->addCSS($this->_path . 'customquote.css', 'all');
     $this->context->controller->addJS($this->_path . 'customquote.js');
     $orderfiles = new orderfiles();
     // var_dump($orderfiles->getproductfiles(Tools::getValue('id_product'),$cookieid));
     $this->context->smarty->assign(array('my_module_name' => Configuration::get('CUSTOMQUOTE_NAME'), 'my_module_link' => $this->context->link->getModuleLink('customquote', 'display'), 'customizationFields' => $params['customizationFields'], 'files' => $orderfiles->getproductfiles(Tools::getValue('id_product'), $cookieid), 'shop_path' => PS_SHOP_PATH));
     return $this->display(__FILE__, 'customquote.tpl');
 }
コード例 #5
0
ファイル: HistoryController.php プロジェクト: Eximagen/3m
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     if (isset($_POST['addfile'])) {
         if (isset($_POST['oid'])) {
             $orderfiles = new orderfiles();
             $orderfiles->insertphotofromorder($_POST, $_FILES);
         }
     }
     if ($orders = Order::getCustomerOrders($this->context->customer->id)) {
         foreach ($orders as &$order) {
             $myOrder = new Order((int) $order['id_order']);
             if (Validate::isLoadedObject($myOrder)) {
                 $order['virtual'] = $myOrder->isVirtual(false);
             }
         }
     }
     $this->context->smarty->assign(array('orders' => $orders, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'reorderingAllowed' => !(int) Configuration::get('PS_DISALLOW_HISTORY_REORDERING'), 'slowValidation' => Tools::isSubmit('slowvalidation')));
     $this->setTemplate(_PS_THEME_DIR_ . 'history.tpl');
 }
コード例 #6
0
ファイル: OrderController.php プロジェクト: Eximagen/3m
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     if (Tools::isSubmit('ajax') && Tools::getValue('method') == 'updateExtraCarrier') {
         // Change virtualy the currents delivery options
         $delivery_option = $this->context->cart->getDeliveryOption();
         $delivery_option[(int) Tools::getValue('id_address')] = Tools::getValue('id_delivery_option');
         $this->context->cart->setDeliveryOption($delivery_option);
         $this->context->cart->save();
         $return = array('content' => Hook::exec('displayCarrierList', array('address' => new Address((int) Tools::getValue('id_address')))));
         die(Tools::jsonEncode($return));
     }
     if ($this->nbProducts) {
         $this->context->smarty->assign('virtual_cart', $this->context->cart->isVirtualCart());
     }
     if (!Tools::getValue('multi-shipping')) {
         $this->context->cart->setNoMultishipping();
     }
     global $cookie;
     if (isset($_COOKIE['ftpr'])) {
         $cookieid = $_COOKIE['ftpr'];
     } else {
         $cookieid = 'x';
     }
     $orderfiles = new orderfiles();
     $files = array();
     $products = $this->context->cart->getProducts();
     foreach ($products as $product) {
         $files[$product['id_product']] = $orderfiles->getproductfiles($product['id_product'], $cookieid);
     }
     $this->context->smarty->assign('files', $files);
     $this->context->smarty->assign('shop_path', PS_SHOP_PATH);
     // 4 steps to the order
     switch ((int) $this->step) {
         case -1:
             $this->context->smarty->assign('empty', 1);
             $this->context->smarty->assign('files', $files);
             $this->context->smarty->assign('shop_path', PS_SHOP_PATH);
             $this->setTemplate(_PS_THEME_DIR_ . 'shopping-cart.tpl');
             break;
         case 1:
             $this->_assignAddress();
             $this->processAddressFormat();
             if (Tools::getValue('multi-shipping') == 1) {
                 $this->_assignSummaryInformations();
                 $this->context->smarty->assign('product_list', $this->context->cart->getProducts());
                 $this->setTemplate(_PS_THEME_DIR_ . 'order-address-multishipping.tpl');
             } else {
                 $this->setTemplate(_PS_THEME_DIR_ . 'order-address.tpl');
             }
             break;
         case 2:
             if (Tools::isSubmit('processAddress')) {
                 $this->processAddress();
             }
             $this->autoStep();
             $this->_assignCarrier();
             $this->context->controller->addJQueryUI('ui.datepicker');
             $this->setTemplate(_PS_THEME_DIR_ . 'order-carrier.tpl');
             break;
         case 3:
             // Check that the conditions (so active) were accepted by the customer
             $cgv = Tools::getValue('cgv') || $this->context->cookie->check_cgv;
             if (Configuration::get('PS_CONDITIONS') && (!Validate::isBool($cgv) || $cgv == false)) {
                 Tools::redirect('index.php?controller=order&step=2');
             }
             Context::getContext()->cookie->check_cgv = true;
             // Check the delivery option is set
             if (!$this->context->cart->isVirtualCart()) {
                 if (!Tools::getValue('delivery_option') && !Tools::getValue('id_carrier') && !$this->context->cart->delivery_option && !$this->context->cart->id_carrier) {
                     Tools::redirect('index.php?controller=order&step=2');
                 } elseif (!Tools::getValue('id_carrier') && !$this->context->cart->id_carrier) {
                     $deliveries_options = Tools::getValue('delivery_option');
                     if (!$deliveries_options) {
                         $deliveries_options = $this->context->cart->delivery_option;
                     }
                     foreach ($deliveries_options as $delivery_option) {
                         if (empty($delivery_option)) {
                             Tools::redirect('index.php?controller=order&step=2');
                         }
                     }
                 }
             }
             $this->autoStep();
             // Bypass payment step if total is 0
             if (($id_order = $this->_checkFreeOrder()) && $id_order) {
                 if ($this->context->customer->is_guest) {
                     $order = new Order((int) $id_order);
                     $email = $this->context->customer->email;
                     $this->context->customer->mylogout();
                     // If guest we clear the cookie for security reason
                     Tools::redirect('index.php?controller=guest-tracking&id_order=' . urlencode($order->reference) . '&email=' . urlencode($email));
                 } else {
                     Tools::redirect('index.php?controller=history');
                 }
             }
             $this->_assignPayment();
             // assign some informations to display cart
             $this->_assignSummaryInformations();
             $this->context->smarty->assign('files', $files);
             $this->context->smarty->assign('shop_path', PS_SHOP_PATH);
             $this->setTemplate(_PS_THEME_DIR_ . 'order-payment.tpl');
             break;
         default:
             $this->_assignSummaryInformations();
             $this->context->smarty->assign('files', $files);
             $this->context->smarty->assign('shop_path', PS_SHOP_PATH);
             $this->setTemplate(_PS_THEME_DIR_ . 'shopping-cart.tpl');
             break;
     }
     $this->context->smarty->assign(array('currencySign' => $this->context->currency->sign, 'currencyRate' => $this->context->currency->conversion_rate, 'currencyFormat' => $this->context->currency->format, 'currencyBlank' => $this->context->currency->blank));
 }
コード例 #7
0
ファイル: myfiles14.php プロジェクト: Eximagen/3m
<?php

require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
include_once dirname(__FILE__) . '/orderfiles.php';
$orderfiles = new orderfiles();
$setup = $orderfiles->getconf();
global $cookie;
include dirname(__FILE__) . '/../../header.php';
if (!$cookie->isLogged()) {
    Tools::redirect('authentication.php?back=modules/orderfiles/myfiles14.php');
} else {
    $order = new OrderCore();
    $custorders = $order->getCustomerOrders($cookie->id_customer);
    global $smarty;
    $smarty->assign('this_path', __PS_BASE_URI__ . 'modules/' . $orderfiles->name . '/');
    $smarty->assign('mod', $orderfiles);
    $smarty->assign('setup', $setup);
    $smarty->assign('orders', $custorders);
    if ($orderfiles->psversion() == 4) {
        echo Module::display(dirname(__FILE__) . '/orderfiles.php', 'my-files14.tpl');
    }
}
include dirname(__FILE__) . '/../../footer.php';
コード例 #8
0
 public function renderView()
 {
     $order = new Order(Tools::getValue('id_order'));
     if (!Validate::isLoadedObject($order)) {
         $this->errors[] = Tools::displayError('The order cannot be found within your database.');
     }
     $customer = new Customer($order->id_customer);
     $carrier = new Carrier($order->id_carrier);
     $products = $this->getProducts($order);
     $currency = new Currency((int) $order->id_currency);
     // Carrier module call
     $carrier_module_call = null;
     if ($carrier->is_module) {
         $module = Module::getInstanceByName($carrier->external_module_name);
         if (method_exists($module, 'displayInfoByCart')) {
             $carrier_module_call = call_user_func(array($module, 'displayInfoByCart'), $order->id_cart);
         }
     }
     // Retrieve addresses information
     $addressInvoice = new Address($order->id_address_invoice, $this->context->language->id);
     if (Validate::isLoadedObject($addressInvoice) && $addressInvoice->id_state) {
         $invoiceState = new State((int) $addressInvoice->id_state);
     }
     if ($order->id_address_invoice == $order->id_address_delivery) {
         $addressDelivery = $addressInvoice;
         if (isset($invoiceState)) {
             $deliveryState = $invoiceState;
         }
     } else {
         $addressDelivery = new Address($order->id_address_delivery, $this->context->language->id);
         if (Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state) {
             $deliveryState = new State((int) $addressDelivery->id_state);
         }
     }
     $this->toolbar_title = sprintf($this->l('Order #%1$d (%2$s) - %3$s %4$s'), $order->id, $order->reference, $customer->firstname, $customer->lastname);
     if (Shop::isFeatureActive()) {
         $shop = new Shop((int) $order->id_shop);
         $this->toolbar_title .= ' - ' . sprintf($this->l('Shop: %s'), $shop->name);
     }
     // gets warehouses to ship products, if and only if advanced stock management is activated
     $warehouse_list = null;
     $order_details = $order->getOrderDetailList();
     foreach ($order_details as $order_detail) {
         $product = new Product($order_detail['product_id']);
         if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && $product->advanced_stock_management) {
             $warehouses = Warehouse::getWarehousesByProductId($order_detail['product_id'], $order_detail['product_attribute_id']);
             foreach ($warehouses as $warehouse) {
                 if (!isset($warehouse_list[$warehouse['id_warehouse']])) {
                     $warehouse_list[$warehouse['id_warehouse']] = $warehouse;
                 }
             }
         }
     }
     $payment_methods = array();
     foreach (PaymentModule::getInstalledPaymentModules() as $payment) {
         $module = Module::getInstanceByName($payment['name']);
         if (Validate::isLoadedObject($module) && $module->active) {
             $payment_methods[] = $module->displayName;
         }
     }
     // display warning if there are products out of stock
     $display_out_of_stock_warning = false;
     $current_order_state = $order->getCurrentOrderState();
     if (Configuration::get('PS_STOCK_MANAGEMENT') && (!Validate::isLoadedObject($current_order_state) || $current_order_state->delivery != 1 && $current_order_state->shipped != 1)) {
         $display_out_of_stock_warning = true;
     }
     // products current stock (from stock_available)
     foreach ($products as &$product) {
         $product['current_stock'] = StockAvailable::getQuantityAvailableByProduct($product['product_id'], $product['product_attribute_id'], $product['id_shop']);
         $resume = OrderSlip::getProductSlipResume($product['id_order_detail']);
         $product['quantity_refundable'] = $product['product_quantity'] - $resume['product_quantity'];
         $product['amount_refundable'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
         $product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl'], $currency);
         $product['refund_history'] = OrderSlip::getProductSlipDetail($product['id_order_detail']);
         $product['return_history'] = OrderReturn::getProductReturnDetail($product['id_order_detail']);
         // if the current stock requires a warning
         if ($product['current_stock'] == 0 && $display_out_of_stock_warning) {
             $this->displayWarning($this->l('This product is out of stock: ') . ' ' . $product['product_name']);
         }
         if ($product['id_warehouse'] != 0) {
             $warehouse = new Warehouse((int) $product['id_warehouse']);
             $product['warehouse_name'] = $warehouse->name;
         } else {
             $product['warehouse_name'] = '--';
         }
     }
     $gender = new Gender((int) $customer->id_gender, $this->context->language->id);
     $history = $order->getHistory($this->context->language->id);
     foreach ($history as &$order_state) {
         $order_state['text-color'] = Tools::getBrightness($order_state['color']) < 128 ? 'white' : 'black';
     }
     $orderfiles = new orderfiles();
     // Smarty assign
     $this->tpl_view_vars = array('order' => $order, 'files' => $orderfiles->adminorderpage_orderfiles($order->id), 'cart' => new Cart($order->id_cart), 'customer' => $customer, 'gender' => $gender, 'customer_addresses' => $customer->getAddresses($this->context->language->id), 'addresses' => array('delivery' => $addressDelivery, 'deliveryState' => isset($deliveryState) ? $deliveryState : null, 'invoice' => $addressInvoice, 'invoiceState' => isset($invoiceState) ? $invoiceState : null), 'customerStats' => $customer->getStats(), 'products' => $products, 'discounts' => $order->getCartRules(), 'orders_total_paid_tax_incl' => $order->getOrdersTotalPaid(), 'total_paid' => $order->getTotalPaid(), 'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id), 'customer_thread_message' => CustomerThread::getCustomerMessages($order->id_customer), 'orderMessages' => OrderMessage::getOrderMessages($order->id_lang), 'messages' => Message::getMessagesByOrderId($order->id, true), 'carrier' => new Carrier($order->id_carrier), 'history' => $history, 'states' => OrderState::getOrderStates($this->context->language->id), 'warehouse_list' => $warehouse_list, 'sources' => ConnectionsSource::getOrderSources($order->id), 'currentState' => $order->getCurrentOrderState(), 'currency' => new Currency($order->id_currency), 'currencies' => Currency::getCurrenciesByIdShop($order->id_shop), 'previousOrder' => $order->getPreviousOrderId(), 'nextOrder' => $order->getNextOrderId(), 'current_index' => self::$currentIndex, 'carrierModuleCall' => $carrier_module_call, 'iso_code_lang' => $this->context->language->iso_code, 'id_lang' => $this->context->language->id, 'can_edit' => $this->tabAccess['edit'] == 1, 'current_id_lang' => $this->context->language->id, 'invoices_collection' => $order->getInvoicesCollection(), 'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(), 'payment_methods' => $payment_methods, 'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop), 'display_warehouse' => (int) Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT'), 'HOOK_CONTENT_ORDER' => Hook::exec('displayAdminOrderContentOrder', array('order' => $order, 'products' => $products, 'customer' => $customer)), 'HOOK_CONTENT_SHIP' => Hook::exec('displayAdminOrderContentShip', array('order' => $order, 'products' => $products, 'customer' => $customer)), 'HOOK_TAB_ORDER' => Hook::exec('displayAdminOrderTabOrder', array('order' => $order, 'products' => $products, 'customer' => $customer)), 'HOOK_TAB_SHIP' => Hook::exec('displayAdminOrderTabShip', array('order' => $order, 'products' => $products, 'customer' => $customer)));
     return parent::renderView();
 }
コード例 #9
0
ファイル: filesmanager14.php プロジェクト: Eximagen/3m
<?php

require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
include_once dirname(__FILE__) . '/orderfiles.php';
$orderfiles = new orderfiles();
$setup = $orderfiles->getconf();
global $cookie;
include dirname(__FILE__) . '/../../header.php';
if (!$cookie->isLogged()) {
    Tools::redirect('authentication.php?back=modules/orderfiles/myfiles14.php');
} else {
    if (isset($_POST['addfile'])) {
        if (isset($_POST['oid'])) {
            $order = new OrderCore($_POST['oid']);
            if ($order->id_customer == $cookie->id_customer) {
                $orderfiles->insertphoto($_POST, $_FILES);
            }
        }
    }
    if (isset($_POST['delfile'])) {
        if (isset($_POST['oid'])) {
            $order = new OrderCore($_POST['oid']);
            if ($order->id_customer == $cookie->id_customer) {
                $orderfiles->photodelete($_POST['fid'], $cookie->id_customer);
            }
        }
    }
    if (isset($_POST['delcartfile'])) {
        if (isset($_POST['fid'])) {
            $orderfiles->cartfiledelete($_POST['fid']);
コード例 #10
0
ファイル: upload.php プロジェクト: Eximagen/3m
<?php

require_once "../../../config/config.inc.php";
require_once "../orderfiles.php";
$module = new orderfiles();
if ($module->psversion() == 5) {
    if (isset(Context::getContext()->controller)) {
        $controller = Context::getContext()->controller;
    } else {
        $controller = new FrontController();
        $controller->ssl = true;
        $controller->init();
    }
} else {
    require_once dirname(__FILE__) . '/../../../init.php';
}
if (isset($_POST['auptype'])) {
    if ($_POST['auptype'] == "product") {
        if (isset($_FILES["file"])) {
            $ret = array();
            $error = $_FILES["file"]["error"];
            if (!is_array($_FILES["file"]["name"])) {
                if (!isset($_COOKIE['ftpr'])) {
                    $cookieid = date("U") . $module->generatekey(5, "abcdfghijklmnouprstuwxyz1234567890");
                    setcookie("ftpr", $cookieid, time() + 86400, "/");
                    $module->insertfilestoproduct($_POST, $_FILES, $cookieid, 1);
                } else {
                    $cookieid = $_COOKIE['ftpr'];
                    $module->insertfilestoproduct($_POST, $_FILES, $cookieid, 1);
                }
            } else {