public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Return Merchandise Authorization (RMA)'), 'image' => '../img/admin/return.gif'), 'input' => array(array('type' => 'hidden', 'name' => 'id_order'), array('type' => 'hidden', 'name' => 'id_customer'), array('type' => 'text_customer', 'label' => $this->l('Customer'), 'name' => '', 'size' => '', 'required' => false), array('type' => 'text_order', 'label' => $this->l('Order'), 'name' => '', 'size' => '', 'required' => false), array('type' => 'free', 'label' => $this->l('Customer explanation'), 'name' => 'question', 'size' => '', 'required' => false), array('type' => 'select', 'label' => $this->l('Status'), 'name' => 'state', 'required' => false, 'options' => array('query' => OrderReturnState::getOrderReturnStates($this->context->language->id), 'id' => 'id_order_return_state', 'name' => 'name'), 'desc' => $this->l('Merchandise return (RMA) status.')), array('type' => 'list_products', 'label' => $this->l('Products'), 'name' => '', 'size' => '', 'required' => false, 'desc' => $this->l('List of products in return package.')), array('type' => 'pdf_order_return', 'label' => $this->l('Return slip'), 'name' => '', 'size' => '', 'required' => false, 'desc' => $this->l('The link is only available after validation and before the parcel gets delivered.'))), 'submit' => array('title' => $this->l('Save')));
     $order = new Order($this->object->id_order);
     $quantity_displayed = array();
     // Customized products */
     if ($returned_customizations = OrderReturn::getReturnedCustomizedProducts((int) $this->object->id_order)) {
         foreach ($returned_customizations as $returned_customization) {
             $quantity_displayed[(int) $returned_customization['id_order_detail']] = isset($quantity_displayed[(int) $returned_customization['id_order_detail']]) ? $quantity_displayed[(int) $returned_customization['id_order_detail']] + (int) $returned_customization['product_quantity'] : (int) $returned_customization['product_quantity'];
         }
     }
     // Classic products
     $products = OrderReturn::getOrdersReturnProducts($this->object->id, $order);
     // Prepare customer explanation for display
     $this->object->question = '<span class="normal-text">' . nl2br($this->object->question) . '</span>';
     $this->tpl_form_vars = array('customer' => new Customer($this->object->id_customer), 'url_customer' => 'index.php?tab=AdminCustomers&id_customer=' . (int) $this->object->id_customer . '&viewcustomer&token=' . Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $this->context->employee->id), 'text_order' => sprintf($this->l('Order #%1$d from %2$s'), $order->id, Tools::displayDate($order->date_upd)), 'url_order' => 'index.php?tab=AdminOrders&id_order=' . (int) $order->id . '&vieworder&token=' . Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $this->context->employee->id), 'picture_folder' => _THEME_PROD_PIC_DIR_, 'returnedCustomizations' => $returned_customizations, 'customizedDatas' => Product::getAllCustomizedDatas((int) $order->id_cart), 'products' => $products, 'quantityDisplayed' => $quantity_displayed, 'id_order_return' => $this->object->id, 'state_order_return' => $this->object->state);
     return parent::renderForm();
 }
 public function hookDisplayBackOfficeTop()
 {
     $today = date('Ymd');
     $validation_token = Tools::getAdminToken('riskifiedAjax' . $today);
     $this->smarty->assign(array('order_id' => Tools::getValue('id_order'), 'base_url' => _PS_BASE_URL_, 'base_uri' => __PS_BASE_URI__, 'ps_version' => _PS_VERSION_, 'token' => $validation_token));
     return $this->display(__FILE__, './views/templates/admin/riskified.tpl');
 }
 /**
  * Initialize cms controller
  * @see FrontController::init()
  */
 public function init()
 {
     if ($id_cms = (int) Tools::getValue('id_cms')) {
         $this->cms = new CMS($id_cms, $this->context->language->id);
     } elseif ($id_cms_category = (int) Tools::getValue('id_cms_category')) {
         $this->cms_category = new CMSCategory($id_cms_category, $this->context->language->id);
     }
     if (Configuration::get('PS_SSL_ENABLED') && Tools::getValue('content_only') && Tools::getValue('id_cms') == (int) Configuration::get('PS_CONDITIONS_CMS_ID') && Validate::isLoadedObject($this->cms)) {
         $this->ssl = true;
     }
     parent::init();
     $this->canonicalRedirection();
     // assignCase (1 = CMS page, 2 = CMS category)
     if (Validate::isLoadedObject($this->cms)) {
         $adtoken = Tools::getAdminToken('AdminCmsContent' . (int) Tab::getIdFromClassName('AdminCmsContent') . (int) Tools::getValue('id_employee'));
         if (!$this->cms->isAssociatedToShop() || !$this->cms->active && Tools::getValue('adtoken') != $adtoken) {
             header('HTTP/1.1 404 Not Found');
             header('Status: 404 Not Found');
         } else {
             $this->assignCase = 1;
         }
     } elseif (Validate::isLoadedObject($this->cms_category)) {
         $this->assignCase = 2;
     } else {
         header('HTTP/1.1 404 Not Found');
         header('Status: 404 Not Found');
     }
 }
Example #4
0
 public function postProcess()
 {
     global $currentIndex, $cookie, $smarty;
     if (Tools::getValue('getReferrerData')) {
         $id_referrer = Tools::getValue('referrer');
         $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS("\n\t\t            select o.id_order, concat(c.firstname, ' ', c.lastname) as 'name', concat(a.`address1`, a.`address2`) as 'address', a.`phone_mobile`, o.`total_paid`, date(c.date_add) as 'date_register'\n                    from ps_orders o \n                    inner join ps_customer c on o.id_customer = c.id_customer\n                    inner join ps_address a on a.`id_address` = o.`id_address_delivery`\n                    where o.id_customer in (select id_customer from ps_customer where id_referrer = " . $id_referrer . ")\n\t\t            ");
         $smarty->assign('referredOrders', $res);
         $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS("\n\t\t            select id_customer, concat(firstname, ' ', lastname) as 'name', date(date_add) as 'date_add' from ps_customer where id_referrer = " . $id_referrer);
         $smarty->assign('referredCustomers', $res);
         $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS("\r\n\t\t            select concat(c.firstname, ' ', c.lastname) as 'name', count(*) as 'total_orders', sum(o.total_paid) as 'total_paid' from ps_orders o \n                    inner join `ps_order_history` oh on oh.id_order = o.id_order\n                    inner join ps_customer c on c.id_customer = o.id_customer\n                    where o.id_customer = " . $id_referrer . "\n                    and oh.id_order_history = (select max(id_order_history) from ps_order_history where id_order = o.id_order)\n                    and oh.id_order_state not in (6, 14, 20)\n\t\t            ");
         $smarty->assign('referrer_details', $res[0]);
         $smarty->assign('orderToken', Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $cookie->id_employee));
     }
     $date_from = Tools::getValue('date_from', date('Y-n-j'));
     $date_to = Tools::getValue('date_to', date('Y-n-j'));
     $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS("\n\t\t        select c.id_customer `customerID`, concat(c.firstname, ' ', c.lastname) as `name`, \n                count(distinct(c2.id_customer)) as 'total_registered',\n                count(o.id_order) as 'total_orders',\n                count(distinct(o.id_customer)) as 'total_friends_orders',\n                round(coalesce(avg(o.total_paid), 0)) as 'avg_order'\n                from ps_customer c\n                inner join ps_customer c2 on c.id_customer = c2.id_referrer\n                left join ps_orders o on o.id_customer = c2.id_customer\n\t\t        inner join `ps_order_history` oh on oh.id_order = o.id_order\n                where date(c2.`date_add`) between '" . $date_from . "' and '" . $date_to . "'\n\t\t        and  oh.id_order_history = (SELECT MAX(`id_order_history`) FROM `ps_order_history` moh WHERE moh.`id_order` = o.`id_order` GROUP BY moh.`id_order`)\n\t\t\t\tand oh.id_order_state not in (6,8,20)\n                group by c.id_customer  \n\t\t        ");
     $friends_shopped = array();
     $avg_order = array();
     foreach ($res as $key => $row) {
         $friends_shopped[$key] = $row['total_friends_orders'];
         $avg_order[$key] = $row['avg_order'];
     }
     array_multisort($friends_shopped, SORT_DESC, $avg_order, SORT_ASC, $res);
     $smarty->assign('date_from', $date_from);
     $smarty->assign('date_to', $date_to);
     $smarty->assign('referrals', $res);
     $smarty->assign('token', $this->token);
     $smarty->assign('customerToken', Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $cookie->id_employee));
 }
 public function __construct($catalogInstance = null)
 {
     $this->_adminCatalogInstance = $catalogInstance;
     global $cookie;
     parent::__construct();
     $this->token = Tools::getAdminToken("AdminCatalogExFeatures" . (int) $this->id . (int) $cookie->id_employee);
 }
 public function postProcess()
 {
     global $currentIndex, $cookie, $smarty;
     $product_ids = Tools::getValue('product_ids');
     $group_id = 0;
     if ($product_ids) {
         $group_id = Tools::getValue('group_id');
         $ids = explode(",", $product_ids);
         //update previous curated products
         $sql = "SELECT group_concat(id_product) FROM vb_product_groups WHERE id_group_type = 1 AND id_group = 1";
         $res = Db::getInstance()->ExecuteS($sql);
         $productIds = array();
         foreach ($res as $row) {
             $productIds[] = $row['id_product'];
         }
         SolrSearch::updateProducts($productIds);
         Db::getInstance(_PS_USE_SQL_SLAVE_)->Execute("\r\n\t\t            delete from vb_product_groups where id_group_type = 1 and id_group = " . $group_id);
         Db::getInstance(_PS_USE_SQL_SLAVE_)->Execute("\r\n\t\t    \t\tdelete from ps_category_product where id_category = " . CAT_CURATED);
         foreach ($ids as $product_id) {
             if (!$product_id) {
                 continue;
             }
             Db::getInstance(_PS_USE_SQL_SLAVE_)->Execute("\n\t\t                insert into vb_product_groups (id_group_type, id_group, id_product)\n\t\t                values (1, " . $group_id . ", " . $product_id . ")\n\t\t                ");
             Db::getInstance(_PS_USE_SQL_SLAVE_)->Execute("\r\n\t\t        \t\tinsert into ps_category_product (id_category, id_product, position)\r\n\t\t        \t\tvalues (" . CAT_CURATED . ", " . $product_id . ", 1)\r\n\t\t        \t\t");
             SolrSearch::updateProduct($product_id);
         }
     }
     //home products
     $product_ids = $this->assign_products('curated_products', 'curated_product_ids', 1);
     $smarty->assign('productToken', Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (int) $cookie->id_employee));
 }
 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => $this->l('Addresses'), 'icon' => 'icon-envelope-alt'), 'input' => array(array('type' => 'text_customer', 'label' => $this->l('Customer'), 'name' => 'id_customer', 'required' => false), array('type' => 'text', 'label' => $this->l('Identification Number'), 'name' => 'dni', 'required' => false, 'col' => '4', 'hint' => $this->l('DNI / NIF / NIE')), array('type' => 'text', 'label' => $this->l('Address alias'), 'name' => 'alias', 'required' => true, 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' &lt;&gt;;=#{}'), array('type' => 'textarea', 'label' => $this->l('Other'), 'name' => 'other', 'required' => false, 'cols' => 15, 'rows' => 3, 'hint' => $this->l('Forbidden characters:') . ' &lt;&gt;;=#{}')), 'submit' => array('title' => $this->l('Save')));
     $id_customer = (int) Tools::getValue('id_customer');
     if (!$id_customer && Validate::isLoadedObject($this->object)) {
         $id_customer = $this->object->id_customer;
     }
     if ($id_customer) {
         $customer = new Customer((int) $id_customer);
         $token_customer = Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $this->context->employee->id);
     }
     $this->tpl_form_vars = array('customer' => isset($customer) ? $customer : null, 'tokenCustomer' => isset($token_customer) ? $token_customer : null);
     // Order address fields depending on country format
     $addresses_fields = $this->processAddressFormat();
     // we use  delivery address
     $addresses_fields = $addresses_fields['dlv_all_fields'];
     // get required field
     $required_fields = AddressFormat::getFieldsRequired();
     // Merge with field required
     $addresses_fields = array_unique(array_merge($addresses_fields, $required_fields));
     $temp_fields = array();
     foreach ($addresses_fields as $addr_field_item) {
         if ($addr_field_item == 'company') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Company'), 'name' => 'company', 'required' => in_array('company', $required_fields), 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' &lt;&gt;;=#{}');
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('VAT number'), 'col' => '2', 'name' => 'vat_number', 'required' => in_array('vat_number', $required_fields));
         } elseif ($addr_field_item == 'lastname') {
             if (isset($customer) && !Tools::isSubmit('submit' . strtoupper($this->table)) && Validate::isLoadedObject($customer) && !Validate::isLoadedObject($this->object)) {
                 $default_value = $customer->lastname;
             } else {
                 $default_value = '';
             }
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Last Name'), 'name' => 'lastname', 'required' => true, 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' 0-9!&amp;lt;&amp;gt;,;?=+()@#"�{}_$%:', 'default_value' => $default_value);
         } elseif ($addr_field_item == 'firstname') {
             if (isset($customer) && !Tools::isSubmit('submit' . strtoupper($this->table)) && Validate::isLoadedObject($customer) && !Validate::isLoadedObject($this->object)) {
                 $default_value = $customer->firstname;
             } else {
                 $default_value = '';
             }
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('First Name'), 'name' => 'firstname', 'required' => true, 'col' => '4', 'hint' => $this->l('Invalid characters:') . ' 0-9!&amp;lt;&amp;gt;,;?=+()@#"�{}_$%:', 'default_value' => $default_value);
         } elseif ($addr_field_item == 'address1') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Address'), 'name' => 'address1', 'col' => '6', 'required' => true);
         } elseif ($addr_field_item == 'address2') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Address') . ' (2)', 'name' => 'address2', 'col' => '6', 'required' => in_array('address2', $required_fields));
         } elseif ($addr_field_item == 'postcode') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Zip/Postal Code'), 'name' => 'postcode', 'col' => '2', 'required' => true);
         } elseif ($addr_field_item == 'city') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('City'), 'name' => 'city', 'col' => '4', 'required' => true);
         } elseif ($addr_field_item == 'country' || $addr_field_item == 'Country:name') {
             $temp_fields[] = array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => in_array('Country:name', $required_fields) || in_array('country', $required_fields), 'col' => '4', 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id), 'id' => 'id_country', 'name' => 'name'));
             $temp_fields[] = array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'required' => false, 'col' => '4', 'options' => array('query' => array(), 'id' => 'id_state', 'name' => 'name'));
         } elseif ($addr_field_item == 'phone') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Home phone'), 'name' => 'phone', 'required' => in_array('phone', $required_fields) || Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'col' => '4', 'hint' => Configuration::get('PS_ONE_PHONE_AT_LEAST') ? sprintf($this->l('You must register at least one phone number.')) : '');
         } elseif ($addr_field_item == 'phone_mobile') {
             $temp_fields[] = array('type' => 'text', 'label' => $this->l('Mobile phone'), 'name' => 'phone_mobile', 'required' => in_array('phone_mobile', $required_fields) || Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'col' => '4', 'hint' => Configuration::get('PS_ONE_PHONE_AT_LEAST') ? sprintf($this->l('You must register at least one phone number.')) : '');
         }
     }
     // merge address format with the rest of the form
     array_splice($this->fields_form['input'], 3, 0, $temp_fields);
     return parent::renderForm();
 }
 public function displaySettings($post_action)
 {
     $curr_order_state = new OrderState((int) $this->mondialrelay->account_shop['MR_ORDER_STATE']);
     $order_state = array('id_order_state' => $this->mondialrelay->account_shop['MR_ORDER_STATE'], 'name' => $curr_order_state->name[$this->context->language->id]);
     $this->context->smarty->assign(array('MR_token_admin_mondialrelay' => Tools::getAdminToken('AdminMondialRelay' . (int) Tab::getIdFromClassName('AdminMondialRelay') . (int) $this->context->employee->id), 'MR_account_set' => MondialRelay::isAccountSet(), 'MR_order_state' => $order_state, 'MR_orders_states_list' => OrderState::getOrderStates($this->context->language->id), 'MR_form_action' => $post_action, 'MR_error_list' => $this->post_errors));
     echo $this->mondialrelay->fetchTemplate('/tpl/admintab/', 'settings');
 }
Example #9
0
 public function __construct()
 {
     global $cookie;
     parent::__construct();
     $this->is_seller = $cookie->profile == (int) Configuration::get('AGILE_MS_PROFILE_ID');
     Shop::$id_shop_owner = $this->is_seller ? $cookie->id_employee : 0;
     if (Module::isInstalled('agilemultipleseller') and !isset($_GET['logout']) and $this->is_seller and (Tools::getValue("controller") == "" or Tools::getValue("controller") == "adminhome")) {
         $tid = Tab::getIdFromClassName('AdminProducts');
         $token = Tools::getAdminToken('AdminProducts' . intval($tid) . intval($cookie->id_employee));
         Tools::redirectAdmin("./index.php?controller=AdminProducts&token=" . $token);
     }
     if (Module::isInstalled('agilesellerlistoptions')) {
         require_once _PS_ROOT_DIR_ . '/modules/agilesellerlistoptions/agilesellerlistoptions.php';
         $aslo_module = new AgileSellerListOptions();
         $msg = $aslo_module->hookAgileAdminTop(null);
         if (!empty($msg)) {
             $this->displayWarning($msg);
         }
     }
     $tab = Tab::getInstanceFromClassName('AdminShopGroup');
     if (Module::isInstalled('agilemultipleshop')) {
         $tab->active = 1;
     } else {
         $tab->active = 0;
     }
     $tab->update();
 }
 public function renderForm()
 {
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     $post = new BlogPost($obj->id_blog_post);
     $obj->post_title = $post->title;
     if (!is_null($obj->id_customer) && !empty($obj->id_customer)) {
         $tokenCustomer = Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $this->context->employee->id);
         $linkCustomer = '?tab=AdminCustomers&id_customer=' . $obj->id_customer . '&viewcustomer&token=' . $tokenCustomer;
         $obj->customer_name_label = '<a href="' . $linkCustomer . '"><strong>' . $obj->customer_name . '</strong></a>';
     } else {
         $obj->customer_name_label = $obj->customer_name;
     }
     $iso = $this->context->language->getIsoById($obj->id_lang);
     $obj->iso_code = $iso ? $iso : '&nbsp;';
     $shop = $this->context->shop->getShop($obj->id_shop);
     $obj->shop_name = $shop ? $shop['name'] : '&nbsp;';
     $this->fields_form = array('legend' => array('title' => '<img src="../img/admin/comment.gif"> ' . $this->l('Comment')), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     $this->fields_form['input'][] = array('type' => 'text_label', 'label' => $this->l('Date :'), 'name' => 'date_add');
     $this->fields_form['input'][] = array('type' => 'text_label', 'label' => $this->l('Post title :'), 'name' => 'post_title');
     $this->fields_form['input'][] = array('type' => 'text_label', 'label' => $this->l('Customer :'), 'name' => 'customer_name_label');
     $this->fields_form['input'][] = array('type' => 'text_label', 'label' => $this->l('Shop :'), 'name' => 'shop_name');
     $this->fields_form['input'][] = array('type' => 'text_label', 'label' => $this->l('Lang :'), 'name' => 'iso_code');
     $this->fields_form['input'][] = array('type' => 'hidden', 'name' => 'customer_name');
     $this->fields_form['input'][] = array('type' => 'hidden', 'name' => 'id_blog_post');
     $this->fields_form['input'][] = array('type' => 'textarea', 'label' => $this->l('Message :'), 'rows' => 4, 'cols' => 92, 'id' => 'comment_content', 'name' => 'content');
     $this->fields_form['input'][] = array('type' => 'radio', 'label' => $this->l('Active :'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))));
     $this->tpl_form_vars = array('comment' => $obj);
     return parent::renderForm();
 }
Example #11
0
 public function getContent()
 {
     global $cookie;
     $tab = 'AdminModuleMenu';
     $token = Tools::getAdminToken($tab . (int) Tab::getIdFromClassName($tab) . (int) $cookie->id_employee);
     Tools::redirectAdmin('index.php?tab=' . $tab . '&token=' . $token);
 }
    public function viewsupplier()
    {
        global $cookie;
        $supplier = $this->loadObject();
        echo '<h2>' . $supplier->name . '</h2>';
        $products = $supplier->getProductsLite(intval($cookie->id_lang));
        echo '<h3>' . $this->l('Total products:') . ' ' . sizeof($products) . '</h3>';
        foreach ($products as $product) {
            $product = new Product($product['id_product'], false, intval($cookie->id_lang));
            echo '<hr />';
            if (!$product->hasAttributes()) {
                echo '
				<table border="0" cellpadding="0" cellspacing="0" class="table width3">
					<tr>
						<th><a href="index.php?tab=AdminCatalog&id_product=' . $product->id . '&addproduct&token=' . Tools::getAdminToken('AdminCatalog' . intval(Tab::getIdFromClassName('AdminCatalog')) . intval($cookie->id_employee)) . '" target="_blank">' . $product->name . '</a></th>
						' . (!empty($product->reference) ? '<th width="150">' . $this->l('Ref:') . ' ' . $product->reference . '</th>' : '') . '
						' . (!empty($product->ean13) ? '<th width="120">' . $this->l('EAN13:') . ' ' . $product->ean13 . '</th>' : '') . '
						' . (Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="50">' . $this->l('Qty:') . ' ' . $product->quantity . '</th>' : '') . '
					</tr>
				</table>';
            } else {
                echo '
				<h3><a href="index.php?tab=AdminCatalog&id_product=' . $product->id . '&addproduct&token=' . Tools::getAdminToken('AdminCatalog' . intval(Tab::getIdFromClassName('AdminCatalog')) . intval($cookie->id_employee)) . '" target="_blank">' . $product->name . '</a></h3>
				<table border="0" cellpadding="0" cellspacing="0" class="table" style="width: 600px;">
	                	<tr>
		                    <th>' . $this->l('Attribute name') . '</th>
		                    <th width="80">' . $this->l('Reference') . '</th>
		                    <th width="80">' . $this->l('EAN13') . '</th>
		                   ' . (Configuration::get('PS_STOCK_MANAGEMENT') ? '<th class="right" width="40">' . $this->l('Quantity') . '</th>' : '') . '
	                	</tr>';
                /* Build attributes combinaisons */
                $combinaisons = $product->getAttributeCombinaisons(intval($cookie->id_lang));
                foreach ($combinaisons as $k => $combinaison) {
                    $combArray[$combinaison['id_product_attribute']]['reference'] = $combinaison['reference'];
                    $combArray[$combinaison['id_product_attribute']]['ean13'] = $combinaison['ean13'];
                    $combArray[$combinaison['id_product_attribute']]['quantity'] = $combinaison['quantity'];
                    $combArray[$combinaison['id_product_attribute']]['attributes'][] = array($combinaison['group_name'], $combinaison['attribute_name'], $combinaison['id_attribute']);
                }
                $irow = 0;
                foreach ($combArray as $id_product_attribute => $product_attribute) {
                    $list = '';
                    foreach ($product_attribute['attributes'] as $attribute) {
                        $list .= $attribute[0] . ' - ' . $attribute[1] . ', ';
                    }
                    $list = rtrim($list, ', ');
                    echo '
					<tr' . ($irow++ % 2 ? ' class="alt_row"' : '') . ' >
						<td>' . stripslashes($list) . '</td>
						<td>' . $product_attribute['reference'] . '</td>
						' . (Configuration::get('PS_STOCK_MANAGEMENT') ? '<td>' . $product_attribute['ean13'] . '</td>' : '') . '
						<td class="right">' . $product_attribute['quantity'] . '</td>
					</tr>';
                }
                unset($combArray);
                echo '</table>';
                echo '</td></tr></table>';
            }
        }
    }
Example #13
0
 public function display()
 {
     global $cookie;
     if (isset($_GET['view' . $this->table])) {
         Tools::redirectAdmin('index.php?tab=AdminOrders&id_order=' . intval($_GET['id_order']) . '&vieworder' . '&token=' . Tools::getAdminToken('AdminOrders' . intval(Tab::getIdFromClassName('AdminOrders')) . intval($cookie->id_employee)));
     } else {
         $this->displayList();
         $this->displayOptionsList();
     }
 }
 public function checkToken()
 {
     global $cookie;
     if ($parentCheck = parent::checkToken()) {
         return $parentCheck;
     } else {
         $token = Tools::getValue('token');
         return !empty($token) and $token === Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (int) $cookie->id_employee);
     }
 }
Example #15
0
    public function hookAdminStatsModules($params)
    {
        global $cookie;
        $customers = $this->getCustomersOnline();
        $totalCustomers = Db::getInstance()->NumRows();
        $visitors = $this->getVisitorsOnline();
        $totalVisitors = Db::getInstance()->NumRows();
        $irow = 0;
        echo '<script type="text/javascript" language="javascript">openCloseLayer(\'calendar\');</script>
		<fieldset class="width3"><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->l('Customers online') . '</legend>';
        if ($totalCustomers) {
            echo $this->l('Total:') . ' ' . intval($totalCustomers) . '
			<table cellpadding="0" cellspacing="0" class="table space">
				<tr><th>' . $this->l('ID') . '</th><th>' . $this->l('Name') . '</th><th>' . $this->l('Current Page') . '</th><th>' . $this->l('View') . '</th></tr>';
            foreach ($customers as $customer) {
                echo '
				<tr' . ($irow++ % 2 ? ' class="alt_row"' : '') . '>
					<td>' . $customer['id_customer'] . '</td>
					<td style="width: 200px;">' . $customer['firstname'] . ' ' . $customer['lastname'] . '</td>
					<td style="width: 200px;">' . $customer['page'] . '</td>
					<td style="text-align: right; width: 25px;">
						<a href="index.php?tab=AdminCustomers&id_customer=' . $customer['id_customer'] . '&viewcustomer&token=' . Tools::getAdminToken('AdminCustomers' . intval(Tab::getIdFromClassName('AdminCustomers')) . intval($cookie->id_employee)) . '" target="_blank">
							<img src="../modules/' . $this->name . '/logo.gif" />
						</a>
					</td>
				</tr>';
            }
            echo '</table>';
        } else {
            echo $this->l('There is no customer online now.');
        }
        echo '</fieldset>
		<fieldset class="width3 space"><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->l('Visitors online') . '</legend>';
        if ($totalVisitors) {
            echo $this->l('Total:') . ' ' . intval($totalVisitors) . '
			<div style="overflow-y: scroll; height: 600px;">
			<table cellpadding="0" cellspacing="0" class="table space">
				<tr><th>' . $this->l('Guest') . '</th><th>' . $this->l('IP') . '</th><th>' . $this->l('Since') . '</th><th>' . $this->l('Current page') . '</th><th>' . $this->l('Referrer') . '</th></tr>';
            foreach ($visitors as $visitor) {
                echo '
					<tr' . ($irow++ % 2 ? ' class="alt_row"' : '') . '>
						<td>' . $visitor['id_guest'] . '</td>
						<td style="width: 80px;">' . long2ip($visitor['ip_address']) . '</td>
						<td style="width: 100px;">' . substr($visitor['date_add'], 11) . '</td>
						<td style="width: 200px;">' . $visitor['page'] . '</td>
						<td style="width: 200px;">' . (empty($visitor['http_referer']) ? $this->l('none') : parse_url($visitor['http_referer'], PHP_URL_HOST)) . '</td>
					</tr>';
            }
            echo '</table>
			</div>';
        } else {
            echo $this->l('There is no visitor online now.');
        }
        echo '</fieldset>';
    }
 /**
  * @inheritdoc
  */
 public function initContent()
 {
     if (!$this->viewAccess()) {
         $this->errors[] = Tools::displayError('You do not have permission to view this.');
         return;
     }
     $id_tab = (int) Tab::getIdFromClassName('AdminModules');
     $id_employee = (int) $this->context->cookie->id_employee;
     $token = Tools::getAdminToken('AdminModules' . $id_tab . $id_employee);
     Tools::redirectAdmin('index.php?controller=AdminModules&configure=nostotagging&token=' . $token);
 }
 /**
  * Launch the export process
  */
 public function launchExport()
 {
     // Addition of a secured token
     if (!Tools::getValue('token') || Tools::getValue('token') != Tools::getAdminToken('DataExtractorController')) {
         return;
     }
     @ini_set('max_execution_time', '3000');
     @ini_set('max_input_time', '3000');
     @ini_set('memory_limit', '384M');
     $oDataExtractor = false;
     $aPrediggoConfigs = array();
     $oContext = Context::getContext();
     foreach (Shop::getCompleteListOfShopsID() as $iIDShop) {
         $oContext->shop = new Shop((int) $iIDShop);
         $aPrediggoConfigs[(int) $iIDShop] = new PrediggoConfig($oContext);
     }
     // Launch Customers export process
     $params = array('aPrediggoConfigs' => array());
     foreach ($aPrediggoConfigs as $iIDShop => $oPrediggoConfig) {
         if ($oPrediggoConfig->customers_file_generation) {
             $params['aPrediggoConfigs'][$iIDShop] = $oPrediggoConfig;
         }
     }
     if (count($params['aPrediggoConfigs'])) {
         $oDataExtractor = new CustomerExtractorToXML($this->sRepositoryPath, $params, (int) $this->oPrediggoConfig->logs_file_generation);
         $this->lauchFileExport($oDataExtractor);
     }
     // Launch Orders export process
     $params = array('aPrediggoConfigs' => array());
     foreach ($aPrediggoConfigs as $iIDShop => $oPrediggoConfig) {
         if ($oPrediggoConfig->orders_file_generation) {
             $params['aPrediggoConfigs'][$iIDShop] = $oPrediggoConfig;
         }
     }
     if (count($params['aPrediggoConfigs'])) {
         $oDataExtractor = new OrderExtractorToXML($this->sRepositoryPath, $params, (int) $this->oPrediggoConfig->logs_file_generation);
         $this->lauchFileExport($oDataExtractor);
     }
     // Launch Products export process
     $params = array('aPrediggoConfigs' => array());
     foreach ($aPrediggoConfigs as $iIDShop => $oPrediggoConfig) {
         if ($oPrediggoConfig->products_file_generation) {
             $params['aPrediggoConfigs'][$iIDShop] = $oPrediggoConfig;
         }
     }
     if (count($params['aPrediggoConfigs'])) {
         $oDataExtractor = new ProductExtractorToXML($this->sRepositoryPath, $params, (int) $this->oPrediggoConfig->logs_file_generation);
         $this->lauchFileExport($oDataExtractor);
     }
 }
 public function __construct()
 {
     $this->bootstrap = true;
     $this->table = 'product';
     $this->className = 'Product';
     $this->list_no_link = true;
     // template path
     $this->template_path = _PS_MODULE_DIR_ . 'erpillicopresta/views/templates/admin/';
     parent::__construct();
     // Get the stock manager type and send it to template
     $this->advanced_stock_management = $this->tpl_list_vars['advanced_stock_management'] = Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT');
     // get controller status
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminInventory'));
     $this->advanced_stock_token = Tools::getAdminToken('AdminAdvancedStock' . (int) Tab::getIdFromClassName('AdminAdvancedStock') . (int) $this->context->employee->id);
     $this->product_token = Tools::getAdminToken('AdminProducts' . (int) Tab::getIdFromClassName('AdminProducts') . (int) $this->context->employee->id);
     $this->mvt_stock_reason = ErpStockMvtReason::getStockMvtReasons((int) $this->context->language->id);
     $this->toolbar_title = $this->l('1 Click ERP ILLICOPRESTA');
     // JMA
     // Record get variables cookies id_warehouse, areaFilter and subareaFilter for Ajax
     if (!Tools::isSubmit('ajax')) {
         $this->setCookie('id_warehouse', Tools::isSubmit('id_warehouse') ? Tools::getValue('id_warehouse') : self::getFirstWarehouse());
         $this->setCookie('areaFilter', Tools::getValue('areaFilter'));
         $this->setCookie('subareaFilter', Tools::getValue('subareaFilter'));
     }
     // Buidl product array
     $global = array('id_product' => array('title' => 'ID', 'width' => 10, 'search' => false, 'class' => 'id_product'), 'picture' => array('title' => $this->l('Picture'), 'align' => 'center', 'image' => 'p', 'width' => 70, 'orderby' => false, 'filter' => false, 'search' => false), 'category_name' => array('title' => $this->l('Category'), 'search' => false, 'callback' => 'renderCategoryNameColumn'), 'reference' => array('title' => $this->l('SKU'), 'search' => false), 'first_supplier_ref' => array('title' => $this->l('Supplier reference'), 'search' => false, 'callback' => 'renderFirstSupplierRefColumn'), 'product_name' => array('title' => $this->l('Label'), 'search' => false, 'callback' => 'renderNameColumn'));
     // if advanced stock manager is inactif, only show the usable quantity in shop
     if (!$this->advanced_stock_management) {
         $quantity = array('quantity' => array('title' => $this->l('Quantity'), 'width' => 50, 'search' => false, 'class' => 'quantity', 'orderby' => false));
         $global = array_merge((array) $global, (array) $quantity);
     } else {
         $quantity = array('physical_quantity' => array('title' => $this->l('Physical quantity'), 'width' => 50, 'search' => false, 'class' => 'physical_quantity', 'orderby' => false), 'location' => array('title' => $this->l('Location'), 'width' => 200, 'search' => false, 'orderby' => false, 'callback' => 'renderLocationColumn'));
         $global = array_merge((array) $global, (array) $quantity);
     }
     $edit = array('mvt_reason' => array('title' => $this->l('Movement reason'), 'width' => 50, 'search' => false, 'orderby' => false, 'callback' => 'renderMvtReasonColumn'), 'new_quantity' => array('title' => $this->l('Found quantity'), 'width' => 50, 'hint' => $this->l('What you actually have'), 'search' => false, 'orderby' => false, 'callback' => 'renderColumnNewQuantity'));
     $this->fields_list = array_merge((array) $global, (array) $edit);
     // if we already have inventory values recorded, send them (pagination & filters)
     if (Tools::isSubmit('inventory_values') && Tools::getValue('inventory_values') != '') {
         $this->context->smarty->assign(array('inventory_values' => Tools::getValue('inventory_values')));
     } else {
         $this->context->smarty->assign(array('inventory_values' => ''));
     }
     // if we get stock gap values already recorded, send them (pagination & filters)
     if (Tools::isSubmit('gap_values') && Tools::getValue('gap_values') != '') {
         $this->context->smarty->assign(array('gap_values' => Tools::getValue('gap_values')));
     } else {
         $this->context->smarty->assign(array('gap_values' => ''));
     }
 }
Example #19
0
 public function __construct()
 {
     $this->table = 'meta';
     $this->className = 'Meta';
     $this->lang = true;
     $this->edit = true;
     $this->delete = true;
     $this->fieldsDisplay = array('id_meta' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'page' => array('title' => $this->l('Page'), 'width' => 120, 'suffix' => '.php'), 'title' => array('title' => $this->l('Title'), 'width' => 120), 'url_rewrite' => array('title' => $this->l('Friendly URL'), 'width' => 120));
     global $cookie;
     $this->optionTitle = $this->l('URLs Setup');
     $this->_fieldsOptions = array('__PS_BASE_URI__' => array('title' => $this->l('PS directory'), 'desc' => $this->l('Name of the PrestaShop directory on your Web server, bracketed by forward slashes (e.g., /shop/)'), 'validation' => 'isUrl', 'type' => 'text', 'size' => 20, 'default' => __PS_BASE_URI__), 'PS_HOMEPAGE_PHP_SELF' => array('title' => $this->l('Homepage file'), 'desc' => $this->l('Usually "index.php", but may be different for a few hosts.'), 'type' => 'string', 'size' => 50), 'PS_SHOP_DOMAIN' => array('title' => $this->l('Shop domain name'), 'desc' => $this->l('Domain name of your shop, used as a canonical URL (e.g., www.myshop.com). Keep it blank if you don\'t know what to do.'), 'validation' => 'isUrl', 'type' => 'text', 'size' => 30, 'default' => ''), 'PS_SHOP_DOMAIN_SSL' => array('title' => $this->l('Shop domain name for SSL'), 'desc' => $this->l('Domain name for the secured area of your shop, used as a canonical URL (e.g., secure.myshop.com). Keep it blank if you don\'t know what to do.'), 'validation' => 'isUrl', 'type' => 'text', 'size' => 30, 'default' => ''), 'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)') . '<p class="hint clear" style="display: block;">' . $this->l('If you turn on this feature, you must') . ' <a href="?tab=AdminGenerator&token=' . Tools::getAdminToken('AdminGenerator' . (int) Tab::getIdFromClassName('AdminGenerator') . (int) $cookie->id_employee) . '">' . $this->l('generate a .htaccess file') . '</a></p><div class="clear"></div>', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CANONICAL_REDIRECT' => array('title' => $this->l('Automatically redirect to Canonical url'), 'desc' => $this->l('Recommended but your theme must be compliant'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'));
     if (!Tools::getValue('__PS_BASE_URI__')) {
         $_POST['__PS_BASE_URI__'] = __PS_BASE_URI__;
     }
     parent::__construct();
 }
 public function __construct()
 {
     parent::__construct();
     $this->bootstrap = true;
     // template path
     $this->template_path = _PS_MODULE_DIR_ . 'erpillicopresta/views/templates/admin/';
     $this->is_1_6 = version_compare(_PS_VERSION_, '1.6') > 0;
     // Get the type of active stock management and send to tpl
     $this->advanced_stock_management = Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT');
     // get controller status
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedStock'));
     $this->product_token = Tools::getAdminToken('AdminProducts' . (int) Tab::getIdFromClassName('AdminProducts') . (int) $this->context->employee->id);
     $this->erp_zone_token = Tools::getAdminToken('AdminErpZone' . (int) Tab::getIdFromClassName('AdminErpZone') . (int) $this->context->employee->id);
     // get controller status
     $this->controller_status = Configuration::get(ErpIllicopresta::getControllerStatusName('AdminAdvancedOrder'));
 }
 public function postProcess()
 {
     $from_admin = Tools::getValue('adtoken') == Tools::getAdminToken('AdminReturn' . (int) Tab::getIdFromClassName('AdminReturn') . (int) Tools::getValue('id_employee'));
     if (!$from_admin && !$this->context->customer->isLogged()) {
         Tools::redirect('index.php?controller=authentication&back=order-follow');
     }
     if (Tools::getValue('id_order_return') && Validate::isUnsignedId(Tools::getValue('id_order_return'))) {
         $this->orderReturn = new OrderReturn(Tools::getValue('id_order_return'));
     }
     if (!isset($this->orderReturn) || !Validate::isLoadedObject($this->orderReturn)) {
         die(Tools::displayError('Order return not found.'));
     } elseif (!$from_admin && $this->orderReturn->id_customer != $this->context->customer->id) {
         die(Tools::displayError('Order return not found.'));
     } elseif ($this->orderReturn->state < 2) {
         die(Tools::displayError('Order return not confirmed.'));
     }
 }
Example #22
0
    public function init()
    {
        if (Tools::getValue('cms_rewrite')) {
            $rewrite_url = Tools::getValue('cms_rewrite');
            $id_cms = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
				SELECT `id_cms`
				FROM `' . _DB_PREFIX_ . 'cms_lang`
				WHERE `link_rewrite` = \'' . $rewrite_url . '\'');
            if ($id_cms > 0) {
                $_GET['id_cms'] = $id_cms;
                $_GET['noredirect'] = 1;
            } else {
                Tools::display404Error();
                die;
            }
        }
        if ($id_cms = (int) Tools::getValue('id_cms')) {
            $this->cms = new CMS($id_cms, $this->context->language->id);
        } else {
            if ($id_cms_category = (int) Tools::getValue('id_cms_category')) {
                $this->cms_category = new CMSCategory($id_cms_category, $this->context->language->id);
            }
        }
        if (Configuration::get('PS_SSL_ENABLED') && Tools::getValue('content_only') && Tools::getValue('id_cms') == (int) Configuration::get('PS_CONDITIONS_CMS_ID') && Validate::isLoadedObject($this->cms)) {
            $this->ssl = true;
        }
        parent::init();
        $this->canonicalRedirection();
        // assignCase (1 = CMS page, 2 = CMS category)
        if (Validate::isLoadedObject($this->cms)) {
            $adtoken = Tools::getAdminToken('AdminCmsContent' . (int) Tab::getIdFromClassName('AdminCmsContent') . (int) Tools::getValue('id_employee'));
            if (!$this->cms->isAssociatedToShop() || !$this->cms->active && Tools::getValue('adtoken') != $adtoken) {
                header('HTTP/1.1 404 Not Found');
                header('Status: 404 Not Found');
            } else {
                $this->assignCase = 1;
            }
        } else {
            if (Validate::isLoadedObject($this->cms_category)) {
                $this->assignCase = 2;
            } else {
                header('HTTP/1.1 404 Not Found');
                header('Status: 404 Not Found');
            }
        }
    }
 public function init()
 {
     global $cookie;
     if (isset($_GET["updateorder_detail"]) and isset($_GET["id_order_detail"]) and (int) $_GET["id_order_detail"] > 0) {
         ${"GLOBALS"}["yaxheiul"] = "id_order_detail";
         ${${"GLOBALS"}["yaxheiul"]} = Tools::getValue("id_order_detail");
         $nkotcipboi = "url";
         $mlqeupaocox = "tabid";
         ${${"GLOBALS"}["xeuiojtfef"]} = new OrderDetail(${${"GLOBALS"}["kwzmtwdwu"]});
         ${"GLOBALS"}["zcuxuhun"] = "newtoekn";
         ${${"GLOBALS"}["aaiesey"]} = Tab::getIdFromClassName("AdminOrders");
         ${${"GLOBALS"}["zcuxuhun"]} = Tools::getAdminToken("AdminOrders" . intval(${$mlqeupaocox}) . intval($cookie->id_employee));
         ${${"GLOBALS"}["epfgdop"]} = "./index.php?controller=adminorders&id_order=" . $orderdetail->id_order . "&vieworder&token=" . ${${"GLOBALS"}["cxphhve"]};
         Tools::redirectAdmin(${$nkotcipboi});
     }
     parent::init();
 }
 public function display()
 {
     global $cookie;
     if (isset($_GET['view' . $this->table]) and !empty($_GET['id_order']) and $_GET['id_order'] != '--') {
         Tools::redirectAdmin('index.php?tab=AdminOrders&id_order=' . intval($_GET['id_order']) . '&vieworder' . '&token=' . Tools::getAdminToken('AdminOrders' . intval(Tab::getIdFromClassName('AdminOrders')) . intval($cookie->id_employee)));
     } else {
         if (isset($_GET['id_order']) and (empty($_GET['id_order']) or $_GET['id_order'] == '--')) {
             echo '<p class="warning bold"><img src="../img/admin/warning.gif" alt="" class="middle" /> &nbsp;' . Tools::displayError('Cannot display this message because the customer has not finalized its order') . '</p>';
         }
         foreach ($this->_list as $k => $item) {
             if (Tools::strlen($item['last_message']) > 150 + Tools::strlen('...')) {
                 $this->_list[$k]['last_message'] = Tools::substr(html_entity_decode($item['last_message'], ENT_QUOTES, 'UTF-8'), 0, 150, 'UTF-8') . '...';
             }
         }
         $this->displayList();
         $this->displayOptionsList();
     }
 }
    public function displayForm($isMainTab = true)
    {
        global $currentIndex, $cookie;
        parent::displayForm();
        $imagesTypes = ImageType::getImagesTypes();
        $imageObj = new Image(Tools::getValue('id_image'));
        echo '
		<script type="text/javascript" src="../js/cropper/prototype.js"></script>
		<script type="text/javascript" src="../js/cropper/scriptaculous.js"></script>
		<script type="text/javascript" src="../js/cropper/builder.js"></script>
		<script type="text/javascript" src="../js/cropper/dragdrop.js"></script>
		<script type="text/javascript" src="../js/cropper/cropper.js"></script>
		<script type="text/javascript" src="../js/cropper/loader.js"></script>
		<form enctype="multipart/form-data"  method="post" action="' . $currentIndex . '&imageresize&token=' . Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (int) $cookie->id_employee) . '">
			<input type="hidden" name="id_product" value="' . Tools::getValue('id_product') . '" />
			<input type="hidden" name="id_category" value="' . Tools::getValue('id_category') . '" />
			<input type="hidden" name="saveandstay" value="' . Tools::getValue('submitAddAndStay') . '" />
			<input type="hidden" name="conf" value="' . Tools::getValue('toconf') . '" />
			<input type="hidden" name="imageresize" value="imageresize" />
			<input type="hidden" name="id_image" value="' . Tools::getValue('id_image') . '" />
			<fieldset>
				<legend><img src="../img/admin/picture.gif" />' . $this->l('Image resize') . '</legend>
				' . $this->l('Using your mouse, define which area of the image is to be used for generating each type of thumbnail.') . '
				<br /><br />
				<img src="' . _THEME_PROD_DIR_ . $imageObj->getExistingImgPath() . '.jpg" id="testImage">
				<label for="imageChoice">' . $this->l('Thumbnails format') . '</label>
				<div class="margin-form"">
					<select name="imageChoice" id="imageChoice">';
        foreach ($imagesTypes as $type) {
            echo '<option value="../img/p/' . $imageObj->getExistingImgPath() . '.jpg|' . $type['width'] . '|' . $type['height'] . '|' . $type['id_image_type'] . '">' . $type['name'] . '</option>';
        }
        echo '		</select>
					<input type="submit" class="button" style="margin-left : 40px;" name="resize" value="' . $this->l('   Save all  ') . '" />
				</div>';
        foreach ($imagesTypes as $type) {
            echo '
				<input type="hidden" name="' . $type['id_image_type'] . '_x1" id="' . $type['id_image_type'] . '_x1" value="0" />
				<input type="hidden" name="' . $type['id_image_type'] . '_y1" id="' . $type['id_image_type'] . '_y1" value="0" />
				<input type="hidden" name="' . $type['id_image_type'] . '_x2" id="' . $type['id_image_type'] . '_x2" value="0" />
				<input type="hidden" name="' . $type['id_image_type'] . '_y2" id="' . $type['id_image_type'] . '_y2" value="0" />';
        }
        echo '	</fieldset>
		</form>';
    }
 private function check_seller_account()
 {
     if (!Module::isInstalled('agilemultipleseller')) {
         return;
     }
     include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php";
     $id_customer = intval(Tools::getValue('id_customer', 0));
     $id_sellerinfo = SellerInfo::getIdByCustomerId($id_customer);
     $tokenSellerinfo = '';
     if ($id_sellerinfo > 0) {
         $tokenSellerinfo = Tools::getAdminToken('AdminSellerinfos' . (int) Tab::getIdFromClassName('AdminSellerinfos') . (int) $this->context->employee->id);
     }
     $tokenSellerEmployee = '';
     $sellerinfo = new SellerInfo($id_sellerinfo);
     if (Validate::isLoadedObject($sellerinfo)) {
         $tokenSellerEmployee = Tools::getAdminToken('AdminEmployees' . (int) Tab::getIdFromClassName('AdminEmployees') . (int) $this->context->employee->id);
     }
     $this->context->smarty->assign(array('id_sellerinfo' => $id_sellerinfo, 'tokenSellerinfo' => $tokenSellerinfo, 'id_seller_empployee' => $sellerinfo->id_seller, 'tokenSellerEmployee' => $tokenSellerEmployee, 'show_seller_options' => $this->is_seller ? 0 : 1));
 }
Example #27
0
 public function __construct()
 {
     global $cookie;
     $this->className = 'Configuration';
     $this->table = 'configuration';
     $tmz = Tools::getTimezones();
     $txs = Tax::getTaxes(intval($cookie->id_lang));
     $timezone = array();
     foreach ($tmz as $id => $name) {
         $timezone[] = array('id' => $id, 'name' => $name);
     }
     $taxes[] = array('id' => 0, 'name' => $this->l('None'));
     foreach ($txs as $tax) {
         $taxes[] = array('id' => $tax['id_tax'], 'name' => $tax['name']);
     }
     $this->_fieldsGeneral = array('PS_BASE_URI' => array('title' => $this->l('PS directory:'), 'desc' => $this->l('Name of the PrestaShop directory on your Web server, bracketed by forward slashes (e.g., /shop/)'), 'validation' => 'isGenericName', 'type' => 'text', 'size' => 20, 'default' => '/'), 'PS_SHOP_ENABLE' => array('title' => $this->l('Enable Shop:'), 'desc' => $this->l('Activate or deactivate your shop. Deactivate your shop while you perform maintenance on it'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_MAINTENANCE_IP' => array('title' => $this->l('Maintenance IP:'), 'desc' => $this->l('IP address allowed to access the Front Office while the shop is disabled (e.g., 42.24.4.2)'), 'validation' => 'isGenericName', 'type' => 'text', 'size' => 15, 'default' => ''), 'PS_SSL_ENABLED' => array('title' => $this->l('Enable SSL'), 'desc' => $this->l('If your hosting provider allows SSL, you can activate SSL encryption (https://) for customer account identification and order processing'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_TOKEN_ENABLE' => array('title' => $this->l('Increase Front Office security'), 'desc' => $this->l('Enable or disable token on the Front Office in order to improve PrestaShop security'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool', 'default' => '0'), 'PS_REWRITING_SETTINGS' => array('title' => $this->l('Friendly URL:'), 'desc' => $this->l('Enable only if your server allows URL rewriting (recommended)') . '<p class="hint clear" style="display: block;">' . $this->l('If you turn on this feature, you must') . ' <a href="?tab=AdminGenerator&token=' . Tools::getAdminToken('AdminGenerator' . intval(Tab::getIdFromClassName('AdminGenerator')) . intval($cookie->id_employee)) . '">' . $this->l('generate a .htaccess file') . '</a></p><div class="clear"></div>', 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_HELPBOX' => array('title' => $this->l('Back Office help boxes:'), 'desc' => $this->l('Enable yellow help boxes which are displayed under form fields in the Back Office'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CONDITIONS' => array('title' => $this->l('Terms of service:'), 'desc' => $this->l('Require customers to accept or decline terms of service before processing the order'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING' => array('title' => $this->l('Offer gift-wrapping:'), 'desc' => $this->l('Suggest gift-wrapping to customer and possibility of leaving a message'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_GIFT_WRAPPING_PRICE' => array('title' => $this->l('Gift-wrapping price:'), 'desc' => $this->l('Set a price for gift-wrapping'), 'validation' => 'isPrice', 'cast' => 'floatval', 'type' => 'price'), 'PS_GIFT_WRAPPING_TAX' => array('title' => $this->l('Gift-wrapping tax:'), 'desc' => $this->l('Set a tax for gift-wrapping'), 'validation' => 'isInt', 'cast' => 'intval', 'type' => 'select', 'list' => $taxes, 'identifier' => 'id'), 'PS_RECYCLABLE_PACK' => array('title' => $this->l('Offer recycled packaging:'), 'desc' => $this->l('Suggest recycled packaging to customer'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'), 'PS_CART_FOLLOWING' => array('title' => $this->l('Cart re-display at login:'******'desc' => $this->l('After customer logs in, recall and display contents of his/her last shopping cart'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'));
     if (function_exists('date_default_timezone_set')) {
         $this->_fieldsGeneral['PS_TIMEZONE'] = array('title' => $this->l('Timezone:'), 'validation' => 'isUnsignedId', 'cast' => 'intval', 'type' => 'select', 'list' => $timezone, 'identifier' => 'id');
     }
     parent::__construct();
 }
Example #28
0
 /**
  * Initialize cms controller
  * @see FrontController::init()
  */
 public function init()
 {
     parent::init();
     if ($id_cms = (int) Tools::getValue('id_cms')) {
         $this->cms = new CMS($id_cms, $this->context->language->id);
     } else {
         if ($id_cms_category = (int) Tools::getValue('id_cms_category')) {
             $this->cms_category = new CMSCategory($id_cms_category, $this->context->language->id);
         }
     }
     $this->canonicalRedirection();
     /* assignCase (1 = CMS page, 2 = CMS category) */
     if (Validate::isLoadedObject($this->cms) && ($this->cms->isAssociatedToShop() && $this->cms->active || Tools::getValue('adtoken') == Tools::getAdminToken('AdminCmsContent' . (int) Tab::getIdFromClassName('AdminCmsContent') . (int) Tools::getValue('id_employee')))) {
         $this->assignCase = 1;
     } else {
         if (Validate::isLoadedObject($this->cms_category)) {
             $this->assignCase = 2;
         } else {
             Tools::redirect('index.php?controller=404');
         }
     }
 }
Example #29
0
 public function getContent()
 {
     /* Update the Configuration option values depending on which form has been submitted */
     if (Tools::isSubmit('SubmitBasicSettings')) {
         $this->_saveSettingsBasic();
     }
     /* VTPayment API credentials should be filled */
     if (Configuration::get('VTPAYMENT_GATEWAY_URL') == '' || Configuration::get('VTPAYMENT_MERCHANT_ID') == '' || Configuration::get('VTPAYMENT_SECRET_KEY') == '') {
         $this->_warning[] = $this->displayError($this->l('In order to use VTPayment, please provide your API credentials.'));
     }
     // add 1.4 token support
     if (method_exists('Tools', 'getAdminTokenLite')) {
         $token = Tools::getAdminTokenLite('AdminModules');
     } else {
         $tabid = (int) Tab::getCurrentTabId();
         $employee_id = (int) $this->context->cookie->id_employee;
         $token = 'AdminModules' . $tabid . $employee_id;
         $token = Tools::getAdminToken($token);
     }
     $this->context->smarty->assign(array('vtpayment_form_link' => './index.php?tab=AdminModules&configure=vtpayment&token=' . Tools::getAdminTokenLite('AdminModules') . '&tab_module=' . $this->tab . '&module_name=vtpayment', 'vtpayment_validation' => empty($this->_validation) ? false : $this->_validation, 'vtpayment_error' => empty($this->_error) ? false : $this->_error, 'vtpayment_warning' => empty($this->_warning) ? false : $this->_warning, 'vtpayment_configuration' => Configuration::getMultiple(array('VTPAYMENT_GATEWAY_URL', 'VTPAYMENT_MERCHANT_ID', 'VTPAYMENT_SECRET_KEY'))));
     return $this->display(__FILE__, 'views/templates/admin/configuration.tpl');
 }
 public function renderForm()
 {
     global $cookie;
     ${"GLOBALS"}["uwnclc"] = "sellerinfo";
     $bmgitbrqeuu = "modules";
     ${"GLOBALS"}["wgdkpcgommt"] = "modules";
     if (!(${${"GLOBALS"}["xeglymvvpvoh"]} = $this->loadObject(true))) {
         return;
     }
     ${"GLOBALS"}["cmwmre"] = "labels";
     $mobaqoqkpbc = "modules";
     $lkpwvshwx = "modules";
     ${"GLOBALS"}["owcninq"] = "modules";
     ${$mobaqoqkpbc} = array();
     ${$bmgitbrqeuu}[] = array("name" => "", "desc" => "--");
     ${${"GLOBALS"}["gqijjcqhgij"]}[] = array("name" => "agilepaypal", "desc" => "Agile Paypal or Agile Paypal Adative");
     if (Module::isInstalled("agilebankwire")) {
         ${${"GLOBALS"}["owcninq"]}[] = array("name" => "bankwire", "desc" => "Aigle Bank Wire");
     }
     if (Module::isInstalled("agilegooglecheckout")) {
         ${${"GLOBALS"}["gqijjcqhgij"]}[] = array("name" => "googlecheckout", "desc" => "Agile Google Checkout");
     }
     ${"GLOBALS"}["eoyekwrdgm"] = "tokenSellerinfo";
     if (Module::isInstalled("agilepaybycheque")) {
         ${${"GLOBALS"}["wgdkpcgommt"]}[] = array("name" => "agilepaybycheque", "desc" => "Agile Pay by check");
     }
     if (Module::isInstalled("agilecashondelivery")) {
         ${${"GLOBALS"}["gqijjcqhgij"]}[] = array("name" => "agilecashondelivery", "desc" => "Aigle Cash On Delivery");
     }
     ${${"GLOBALS"}["cmwmre"]} = "\n\t\t\tvar labels = {\n\t\t\t\tagilepaypal: {info1:\"" . $this->l('Paypal Address:') . "\",info2:\"N/A\",info3:\"N/A\",info4:\"N/A\",info5:\"N/A\" } \n\t\t\t\t,bankwire: {info1:\"" . $this->l('Account Owner:') . "\",info2:\"" . $this->l('Details:') . "\",info3:\"" . $this->l('Bank address:') . "\",info4:\"N/A\",info5:\"N/A\"}\n\t\t\t\t,googlecheckout: {info1:\"" . $this->l('Merchant ID:') . "\",info2:\"" . $this->l('Merchant Key:') . "\",info3:\"N/A\",info4:\"N/A\",info5:\"N/A\"}\n\t\t\t\t,agilepaybycheque: {info1:\"" . $this->l('To the order of:') . "\",info2:\"" . $this->l('Address:') . "\",info3:\"N/A\",info4:\"N/A\",info5:\"N/A\"}\n\t\t\t\t,agilecashondelivery: {info1:\"" . $this->l('Notes at order:') . "\",info2:\"N/A\",info3:\"N/A\",info4:\"N/A\",info5:\"N/A\"} \n\t\t\t };\t\t\n\t\t";
     $this->fields_form = array("legend" => array("title" => $this->l('Seller Payment Info'), "image" => "../img/admin/tab-customers.gif"), "input" => array(array("type" => "text_sellerinfo", "label" => $this->l('Seller:'), "name" => "id_sellerinfo", "size" => 33, "required" => false), array("type" => "select", "label" => $this->l('Payment Module:'), "name" => "module_name", "options" => array("query" => ${$lkpwvshwx}, "id" => "name", "name" => "desc"), "required" => false), array("type" => "checkbox", "name" => "in_use", "values" => array("query" => array(array("id" => "on", "name" => $this->l('In Use'), "val" => "1")), "id" => "id", "name" => "name"), "required" => false), array("type" => "textarea", "label" => $this->l('Field 1:'), "name" => "info1", "rows" => 3, "cols" => 100, "required" => false), array("type" => "textarea", "label" => $this->l('Field 2:'), "name" => "info2", "rows" => 3, "cols" => 100, "required" => false), array("type" => "textarea", "label" => $this->l('Field 3:'), "name" => "info3", "rows" => 3, "cols" => 100, "required" => false), array("type" => "textarea", "label" => $this->l('Field 4:'), "name" => "info4", "size" => 33, "required" => false), array("type" => "textarea", "label" => $this->l('Field 5:'), "name" => "info5", "rows" => 3, "cols" => 100, "required" => false)));
     $this->fields_form["submit"] = array("title" => $this->l('Save'), "class" => "btn btn-default pull-right");
     ${${"GLOBALS"}["mdpjsyd"]} = new SellerInfo(SellerInfo::getIdBSellerId($this->object->id_seller));
     ${${"GLOBALS"}["eoyekwrdgm"]} = Tools::getAdminToken("AdminSellerinfos" . (int) Tab::getIdFromClassName("AdminSellerinfos") . (int) $this->context->employee->id);
     $this->tpl_form_vars = array("agilemultipleseller_views" => _PS_ROOT_DIR_ . "/modules/agilemultipleseller/views/", "base_dir" => _PS_BASE_URL_ . __PS_BASE_URI__, "base_dir_ssl" => _PS_BASE_URL_SSL_ . __PS_BASE_URI__, "sellerinfo" => ${${"GLOBALS"}["uwnclc"]}, "tokenSellerinfo" => ${${"GLOBALS"}["fwqgvgb"]}, "sellers" => AgileSellerManager::getSellersNV(true, "--"), "is_seller" => $cookie->profile == (int) Configuration::get("AGILE_MS_PROFILE_ID"), "labels" => ${${"GLOBALS"}["krpmgdw"]});
     $this->fields_value = array("in_use_on" => $this->getFieldValue(${${"GLOBALS"}["xeglymvvpvoh"]}, "in_use"));
     return parent::renderForm();
 }