public function getFooter() { $parent_footer = parent::getFooter(); if (!isset($this->order) or !Validate::isLoadedObject($this->order)) { return $parent_footer; } if (!Module::isInstalled('agilemultipleseller')) { return $parent_footer; } require_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php"; $id_seller = AgileSellerManager::getObjectOwnerID('order', $this->order->id); $sellerinfo = new SellerInfo(SellerInfo::getIdBSellerId($id_seller), $this->order->id_lang); $id_lang = intval(Configuration::get('PS_COUNTRY_DEFAULT')); $this->smarty->assign(array('seller_name' => $sellerinfo->company, 'seller_address' => $sellerinfo->fulladdress($id_lang), 'seller_fax' => $sellerinfo->fax, 'seller_phone' => $sellerinfo->phone, 'sellerinfo' => $sellerinfo)); return $this->smarty->fetch($this->getTemplate('footer')); }
public function postProcess() { ${"GLOBALS"}["blpimnned"] = "id_order_seller"; $dbodbxes = "id_order"; ${${"GLOBALS"}["qusrvgm"]} = (int) Tools::getValue("id_order"); if (!$this->context->customer->isLogged() && !Tools::getValue("secure_key")) { Tools::redirect("index.php?controller=authentication&back=my-account"); } ${"GLOBALS"}["tvasln"] = "id_order"; $jpdhpfqcj = "id_order"; if (!(int) Configuration::get("PS_INVOICE")) { die(Tools::displayError("Invoices are disabled in this shop.")); } if (isset(${${"GLOBALS"}["qusrvgm"]}) && Validate::isUnsignedId(${$dbodbxes})) { ${${"GLOBALS"}["ymjzko"]} = new Order(${$jpdhpfqcj}); } if (!isset(${${"GLOBALS"}["ymjzko"]}) || !Validate::isLoadedObject(${${"GLOBALS"}["ymjzko"]})) { die(Tools::displayError("Invoice not found")); } ${${"GLOBALS"}["vewtbt"]} = AgileSellerManager::getObjectOwnerID("order", ${${"GLOBALS"}["tvasln"]}); ${${"GLOBALS"}["sokafjqdei"]} = AgileSellerManager::getLinkedSellerID($this->context->customer->id); if (${${"GLOBALS"}["blpimnned"]} != ${${"GLOBALS"}["sokafjqdei"]}) { die(Tools::displayError("You do not have permission to see this invoice")); } if (Tools::isSubmit("secure_key") && $order->secure_key != Tools::getValue("secure_key")) { die(Tools::displayError("You do not have permission to see this invoice")); } if (!OrderState::invoiceAvailable($order->getCurrentState()) && !$order->invoice_number) { die(Tools::displayError("No invoice available")); } $this->order = ${${"GLOBALS"}["ymjzko"]}; }
public static function addSqlAssociation($table, $alias, $inner_join = true, $on = null, $force_not_default = false) { $sql = parent::addSqlAssociation($table, $alias, $inner_join, $on, $force_not_default); if (!Module::isInstalled('agilemultipleshop')) { return $sql; } $eaccess = AgileSellerManager::get_entity_access($table); if ($eaccess['owner_table_type'] == AgileSellerManager::OWNER_TABLE_UNKNOWN) { return $sql; } $xr_table = $eaccess['owner_xr_table']; $include_shared = ''; if (!$eaccess['is_exclusive']) { $include_shared = ',0'; } if (Shop::$id_shop_owner > 0) { $join = $inner_join ? 'INNER JOIN ' : 'LEFT JOIN '; if ($table == 'feature') { $join = 'LEFT JOIN '; } if ($eaccess['owner_table_type'] == AgileSellerManager::OWNER_TABLE_DEFINED) { $sql .= $join . _DB_PREFIX_ . $table . '_owner ' . $table . '_owner ON (' . $alias . '.id_' . $table . '=' . $table . '_owner.id_' . $table . ' AND IFNULL(' . $table . '_owner.id_owner,0) IN (' . Shop::$id_shop_owner . $include_shared . '))'; } else { $sql .= $join . _DB_PREFIX_ . 'object_owner ' . $table . '_object_owner ON (' . $table . '_object_owner.entity=\'' . $table . '\' AND ' . $alias . '.id_' . $table . '= ' . $table . '_object_owner.id_object AND IFNULL(' . $table . '_object_owner.id_owner,0) IN (' . Shop::$id_shop_owner . $include_shared . '))'; } } return $sql; }
private function listAllowed() { global $smarty; if (Module::isInstalled('agilemultipleseller')) { include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/agilemultipleseller.php"; include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php"; $id_owner = AgileSellerManager::getObjectOwnerID('product', Tools::getValue('id_product')); $smarty->assign(array('id_seller' => $id_owner)); if ($id_owner > 0) { if (intval(Configuration::get('AGILE_MS_PRODUCT_APPROVAL')) == 1) { $approved = AgileMultipleSeller::is_list_approved(Tools::getValue('id_product')); if ($approved != 1) { return false; } } if (Module::isInstalled('agilesellerlistoptions')) { include_once _PS_ROOT_DIR_ . "/modules/agilesellerlistoptions/agilesellerlistoptions.php"; $listoption = AgileSellerListOptions::get_product_list_option(Tools::getValue('id_product'), AgileSellerListOptions::ASLO_OPTION_LIST); $liststatus = intval($listoption['status']); $aslo_list_prod_id = intval(Configuration::get('ASLO_PROD_FOR_OPTION' . AgileSellerListOptions::ASLO_OPTION_LIST)); if ($liststatus != AgileSellerListOptions::ASLO_STATUS_IN_EFFECT && $aslo_list_prod_id != AgileSellerListOptions::ASLO_ALWAYS_FREE) { return false; } } } } return true; }
protected function afterUpdate($object) { $res = parent::afterUpdate($object); if ($res && Module::isInstalled('agilemultipleseller') && Tools::getValue('id_employee') && Tools::getValue('passwd')) { AgileSellerManager::syncSellerCredentials('b2f', Tools::getValue('id_employee')); } return $res; }
public function renderView() { global $cookie; if (Module::isInstalled('agilemultipleseller') && !intval(Tools::getValue('id_product')) and $this->is_seller and AgileSellerManager::limited_by_membership($cookie->id_employee)) { $this->errors[] = Tools::displayError('You have not purchased membership yet or you have registered products more than limit allowed by your membership.'); return; } return parent::renderView(); }
public static function generateHtaccess($path = null, $rewrite_settings = null, $cache_control = null, $specific = '', $disable_multiviews = null, $medias = false, $disable_modsec = null) { if (Module::isInstalled('agilemultipleseller')) { AgileSellerManager::ensure_configuration_record_for_all_shops(); Configuration::loadConfiguration(); return self::generateHtaccess_override($path, $rewrite_settings, $cache_control, $specific, $disable_multiviews, $medias, $disable_modsec, $disable_modsec); } return parent::generateHtaccess($path, $rewrite_settings, $cache_control, $specific, $disable_multiviews, $medias, $disable_modsec); }
public function initContent() { parent::initContent(); ${${"GLOBALS"}["fchupvb"]} = AgileSellerManager::getOrders($this->sellerinfo->id_seller, true, $this->context, true); $this->pagination(${${"GLOBALS"}["fchupvb"]}); ${${"GLOBALS"}["jejxhem"]} = AgileSellerManager::getOrders($this->sellerinfo->id_seller, true, $this->context, false, $this->p, $this->n, $this->orderBy, $this->orderWay); self::$smarty->assign(array("seller_tab_id" => 4, "orders" => ${${"GLOBALS"}["jejxhem"]}, "invoiceAllowed" => (int) Configuration::get("PS_INVOICE"))); $this->setTemplate("sellerorders.tpl"); }
public function delete() { $ret = parent::delete(); if (Module::isInstalled('agilemultipleseller')) { AgileSellerManager::disableSellerProducts($this->id); AgileSellerManager::deleteSellerInfo($this->id); } return $ret; }
public function postProcess() { parent::postProcess(); if (Module::isInstalled('agilemultipleseller') && Tools::getValue('passwd')) { include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php"; $id_seller = SellerInfo::getSellerIdByCustomerId(Context::getContext()->customer->id); AgileSellerManager::syncSellerCredentials('f2b', $id_seller); } }
public function renderGenericForm($fields_form, $fields_value, $tpl_vars = array()) { if ($fields_form['form']['form']['id_form'] == 'step_carrier_summary') { $fields_value['id_seller'] = AgileSellerManager::getObjectOwnerID('carrier', Tools::getValue('id_carrier')); if ($this->is_seller) { array_unshift($fields_form['form']['form']['input'], array('type' => 'hidden', 'label' => $this->l('Seller:'), 'name' => 'id_seller', 'required' => false)); } else { array_unshift($fields_form['form']['form']['input'], array('type' => 'select', 'label' => $this->l('Seller:'), 'name' => 'id_seller', 'required' => false, 'default_value' => $fields_value['id_seller'], 'options' => array('query' => AgileSellerManager::getSellersNV(true, $this->l('Store Shared')), 'id' => 'id_seller', 'name' => 'name'), 'desc' => $this->l('If this is private seller data, please choose the seller. Otherwise please choose Store Shared'))); } } return parent::renderGenericForm($fields_form, $fields_value, $tpl_vars); }
protected function afterUpdate($object) { $res = parent::afterUpdate($object); if ($res && Module::isInstalled('agilemultipleseller')) { if (Tools::getValue('id_customer') && Tools::getValue('passwd')) { include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php"; $id_seller = SellerInfo::getSellerIdByCustomerId(Tools::getValue('id_customer')); AgileSellerManager::syncSellerCredentials('f2b', $id_seller); } $this->create_seller_account($object); } return $res; }
public function processSave() { global $cookie; $obj = parent::processSave(); if (!Module::isInstalled('agilemultipleseller')) { return $obj; } if ($this->is_seller) { AgileSellerManager::assignObjectOwner('feature', $obj->id, $cookie->id_employee); } else { AgileSellerManager::assignObjectOwner('feature', $obj->id, Tools::getValue('id_seller')); } return $obj; }
public static function Send($id_lang, $template, $subject, $templateVars, $to, $toName = NULL, $from = NULL, $fromName = NULL, $fileAttachment = NULL, $modeSMTP = NULL, $templatePath = _PS_MAIL_DIR_, $die = false, $id_shop = NULL, $bcc = null) { if (Module::isInstalled('agileprepaidcredit') and $template == 'payment_error') { if (AgilePrepaidCredit::isPaymentErrorCausedByTokens($templateVars) > 0) { return true; } } $order_info_templates = array('order_conf', 'bankwire', 'cheque', 'new_order'); if (Module::isInstalled('agilesellershipping') and in_array($template, $order_info_templates)) { AgileSellerManager::adjust_shipping_cost_carriers($templateVars); } if (Module::isInstalled('agilepickupcenter') and $template == 'order_conf') { require_once _PS_ROOT_DIR_ . "/modules/agilepickupcenter/agilepickupcenter.php"; $amodule = new AgilePickupCenter(); $templateVars = $amodule->transform_mail_data($templateVars); if (isset($templateVars['{carrier_email}']) and Validate::isEmail($templateVars['{carrier_email}'])) { parent::Send($id_lang, $template, $subject, $templateVars, $templateVars['{carrier_email}'], $toName, $from, $fromName, $fileAttachment, $modeSMTP, $templatePath, $die, $id_shop, $bcc); } } if (in_array($template, $order_info_templates)) { $shop_email = Configuration::get('PS_SHOP_EMAIL'); if (Module::isInstalled('agilemultipleseller')) { require_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php"; $templateVars = AgileSellerManager::appendMailTemplateVars($templateVars, $id_lang); } if (Module::isInstalled('agileprepaidcredit') and in_array($template, array('bankwire', 'cheque'))) { require_once _PS_ROOT_DIR_ . "/modules/agileprepaidcredit/agileprepaidcredit.php"; $templateVars = AgilePrepaidCredit::replace_amount2pay($templateVars); } parent::Send($id_lang, $template, $subject, $templateVars, $shop_email, $toName, $from, $fromName, $fileAttachment, $modeSMTP, $templatePath, $die, $id_shop, $bcc); } if (Module::isInstalled('agilemultipleseller') and $template == 'order_customer_comment') { $id_order = intval($templateVars['{id_order}']); $id_seller = AgileSellerManager::getObjectOwnerID('order', $id_order); $seller = new Employee($id_seller); parent::Send($id_lang, $template, $subject, $templateVars, $seller->email, $toName, $from, $fromName, $fileAttachment, $modeSMTP, $templatePath, $die, $id_shop, $bcc); } if (Module::isInstalled('agilemultipleseller') and $template == 'order_conf') { require_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/agilemultipleseller.php"; AgileMultipleSeller::sendNewOrderMail($id_lang, $templateVars, $from, $fromName, $fileAttachment, $modeSMTP, $die, $id_shop, $bcc); } return parent::Send($id_lang, $template, $subject, $templateVars, $to, $toName, $from, $fromName, $fileAttachment, $modeSMTP, $templatePath, $die, $id_shop, $bcc); }
public static function getCarriers($id_lang, $active = false, $delete = false, $id_zone = false, $ids_group = NULL, $modules_filters = 1) { global $cookie, $cart; $carriers = parent::getCarriers($id_lang, $active, $delete, $id_zone, $ids_group, $modules_filters); if (!Module::isInstalled('agilemultipleseller')) { return $carriers; } $id_seller_for_filter = AgileSellerManager::get_id_seller_for_filter(); if ((int) $id_seller_for_filter <= 0) { return $carriers; } $retCarriers = array(); foreach ($carriers as $carrier) { $id_owner = AgileSellerManager::getObjectOwnerID('carrier', $carrier['id_carrier']); if ($id_seller_for_filter == $id_owner || $id_owner == 0) { $retCarriers[] = $carrier; } } return $retCarriers; }
public static function getCustomerOrders($id_customer, $showHiddenStatus = false, Context $context = null) { $res = parent::getCustomerOrders($id_customer, $showHiddenStatus, $context); if (!Module::isInstalled('agilemultipleseller')) { return $res; } if ($context == null) { $context = Context::getContext(); } if ($context->cookie->id_employee == 0 || $context->cookie->profile != (int) Configuration::get('AGILE_MS_PROFILE_ID')) { return $res; } $ret = array(); foreach ($res as $data) { $id_owner = AgileSellerManager::getObjectOwnerID('order', $data['id_order']); if ($id_owner != $context->cookie->id_employee) { continue; } $ret[] = $data; } return $ret; }
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(); }
public static function getAttachments($id_lang, $id_product, $include = true) { if (Module::isInstalled('agilemultipleseller')) { $id_seller_for_filter = AgileSellerManager::get_id_seller_for_filter4att(); if ((int) $id_seller_for_filter <= 0) { return parent::getAttachments($id_lang, $id_product, $include); } return Db::getInstance()->executeS(' SELECT * FROM ' . _DB_PREFIX_ . 'attachment a LEFT JOIN ' . _DB_PREFIX_ . 'object_owner oo ON oo.entity = \'attachment\' AND a.id_attachment = oo.id_object LEFT JOIN ' . _DB_PREFIX_ . 'attachment_lang al ON (a.id_attachment = al.id_attachment AND al.id_lang = ' . (int) $id_lang . ') WHERE (oo.id_owner = ' . $id_seller_for_filter . ' OR oo.id_owner = 0) AND a.id_attachment ' . ($include ? 'IN' : 'NOT IN') . ' ( SELECT pa.id_attachment FROM ' . _DB_PREFIX_ . 'product_attachment pa WHERE id_product = ' . (int) $id_product . ' )'); } else { return parent::getAttachments($id_lang, $id_product, $include); } }
public static function getXRObjectID($table, $objid) { ${"GLOBALS"}["wvxhfsz"] = "xr_objid"; $sxhuthfjzxd = "table"; $klqcsqjco = "eaccess"; $tddeevgtif = "xr_objid"; ${${"GLOBALS"}["tcmttublc"]} = AgileSellerManager::get_entity_access(${$sxhuthfjzxd}); ${${"GLOBALS"}["wvxhfsz"]} = intval(Tools::getValue("id_" . ${$klqcsqjco}["owner_xr_table"])); if (${$tddeevgtif} == 0) { $eekhmedqt = "table"; $czzvtmvbqe = "xr_objid"; ${"GLOBALS"}["cjaqbfsnkr"] = "sql"; $nhazfhbzy = "table"; $gqoaxc = "eaccess"; $gymblt = "objid"; ${${"GLOBALS"}["cjaqbfsnkr"]} = "SELECT id_" . ${$gqoaxc}["owner_xr_table"] . " FROM " . _DB_PREFIX_ . ${$nhazfhbzy} . " WHERE id_" . ${$eekhmedqt} . "=" . ${$gymblt}; ${$czzvtmvbqe} = Db::getInstance()->getValue(${${"GLOBALS"}["iikyewhoyyrc"]}); } return ${${"GLOBALS"}["xmoknveemxo"]}; }
public static function getProducts($id_manufacturer, $id_lang, $p, $n, $orderBy = NULL, $orderWay = NULL, $getTotal = false, $active = true, $active_category = true, Context $context = NULL) { global $cookie; $agile_sql_parts = AgileSellerManager::getAdditionalSqlForProducts("p"); if (empty($agile_sql_parts['joins']) or empty($agile_sql_parts['wheres'])) { parent::getProducts($id_manufacturer, $id_lang, $p, $n, $orderBy, $orderWay, $getTotal, $active, $active_category); } if ($p < 1) { $p = 1; } if (empty($orderBy) || $orderBy == 'position') { $orderBy = 'name'; } if (empty($orderWay)) { $orderWay = 'ASC'; } if (!Validate::isOrderBy($orderBy) or !Validate::isOrderWay($orderWay)) { die(Tools::displayError()); } $groups = FrontController::getCurrentCustomerGroups(); $sqlGroups = count($groups) ? 'IN (' . implode(',', $groups) . ')' : '= 1'; if ($getTotal) { $sql = ' SELECT p.`id_product` FROM `' . _DB_PREFIX_ . 'product` p ' . $agile_sql_parts['joins'] . ' WHERE p.id_manufacturer = ' . (int) $id_manufacturer . ($active ? ' AND p.`active` = 1' : '') . ' ' . $agile_sql_parts['wheres'] . ' AND p.`id_product` IN ( SELECT cp.`id_product` FROM `' . _DB_PREFIX_ . 'category_group` cg LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.`id_category` = cg.`id_category`)' . ($active_category ? ' INNER JOIN `' . _DB_PREFIX_ . 'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '') . ' WHERE cg.`id_group` ' . $sqlGroups . ' )'; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); return (int) sizeof($result); } $sql = ' SELECT p.*, pa.`id_product_attribute`, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL ' . (Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20) . ' DAY)) > 0 AS new, (p.`price` * ((100 + (t.`rate`))/100)) AS orderprice ' . $agile_sql_parts['selects'] . ' FROM `' . _DB_PREFIX_ . 'product` p ' . $agile_sql_parts['joins'] . ' LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON (p.`id_product` = pa.`id_product` AND default_on = 1) LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = ' . (int) $id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1) LEFT JOIN `' . _DB_PREFIX_ . 'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = ' . (int) $id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group` AND tr.`id_country` = ' . (int) (_PS_VERSION_ > '1.5' ? Context::getContext()->country->id : Country::getDefaultCountryId()) . ' AND tr.`id_state` = 0) LEFT JOIN `' . _DB_PREFIX_ . 'tax` t ON (t.`id_tax` = tr.`id_tax`) LEFT JOIN `' . _DB_PREFIX_ . 'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = ' . (int) $id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer` WHERE p.`id_manufacturer` = ' . (int) $id_manufacturer . ($active ? ' AND p.`active` = 1' : '') . ' ' . $agile_sql_parts['wheres'] . ' AND p.`id_product` IN ( SELECT cp.`id_product` FROM `' . _DB_PREFIX_ . 'category_group` cg LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.`id_category` = cg.`id_category`)' . ($active_category ? ' INNER JOIN `' . _DB_PREFIX_ . 'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '') . ' WHERE cg.`id_group` ' . $sqlGroups . ' ) ORDER BY ' . ($orderBy == 'id_product' ? 'p.' : '') . '`' . pSQL($orderBy) . '` ' . pSQL($orderWay) . ' LIMIT ' . ((int) $p - 1) * (int) $n . ',' . (int) $n; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); if (!$result) { return false; } if ($orderBy == 'price') { Tools::orderbyPrice($result, $orderWay); } $finalResults = Product::getProductsProperties($id_lang, $result); $finalResults = AgileSellerManager::prepareSellerRattingInfo($finalResults); return $finalResults; }
protected function getProducts($id_lang, $p, $n, $orderBy = NULL, $orderWay = NULL, $getTotal = false, $active = true, $random = false, $randomNumberProducts = 1) { global $cookie, $smarty; $id_seller = $this->seller->id; if ($p < 1) { $p = 1; } if ($n <= 0) { $n = 10; } if (empty($orderBy)) { $orderBy = 'price'; } else { $orderBy = strtolower($orderBy); } if (empty($orderWay)) { $orderWay = 'ASC'; } if ($orderBy == 'id_product' or $orderBy == 'date_add') { $orderByPrefix = 'p'; } elseif ($orderBy == 'name') { $orderByPrefix = 'pl'; } elseif ($orderBy == 'manufacturer') { $orderByPrefix = 'm'; $orderBy = 'name'; } if ($orderBy == 'price') { $orderBy = 'orderprice'; } if (!Validate::isBool($active) or !Validate::isOrderBy($orderBy) or !Validate::isOrderWay($orderWay)) { die(Tools::displayError()); } $agile_sql_parts = AgileSellerManager::getAdditionalSqlForProducts("p", true); if (Module::isInstalled('agilesellerlistoptions') && empty($orderby)) { $orderby = 'position2'; } if ($getTotal) { $sql = ' SELECT COUNT(po.`id_product`) AS total FROM `' . _DB_PREFIX_ . 'product` p LEFT JOIN `' . _DB_PREFIX_ . 'product_owner` po ON p.`id_product` = po.`id_product` ' . $agile_sql_parts['joins'] . ' WHERE p.id_category_default>0 AND po.`id_owner` = ' . (int) $this->seller->id . ' ' . ($active ? ' AND p.`active` = 1' : '') . ' ' . $agile_sql_parts['wheres'] . ' '; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); return isset($result) ? $result['total'] : 0; } $sql = ' SELECT p.*, pa.`id_product_attribute`, pl.`description`, pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`, cl.`name` AS category_default, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL ' . (Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20) . ' DAY)) > 0 AS new, (p.`price` * IF(t.`rate`,((100 + (t.`rate`))/100),1)) AS orderprice ' . $agile_sql_parts['selects'] . ' FROM `' . _DB_PREFIX_ . 'product_owner` po LEFT JOIN `' . _DB_PREFIX_ . 'product` p ON p.`id_product` = po.`id_product` LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON (p.`id_product` = pa.`id_product` AND default_on = 1) LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = ' . (int) $cookie->id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = ' . (int) $cookie->id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1) LEFT JOIN `' . _DB_PREFIX_ . 'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = ' . (int) $cookie->id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group` AND tr.`id_country` = ' . (int) (_PS_VERSION_ > '1.5' ? Context::getContext()->country->id : Country::getDefaultCountryId()) . ' AND tr.`id_state` = 0) LEFT JOIN `' . _DB_PREFIX_ . 'tax` t ON (t.`id_tax` = tr.`id_tax`) LEFT JOIN `' . _DB_PREFIX_ . 'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = ' . (int) $cookie->id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer` ' . $agile_sql_parts['joins'] . ' WHERE p.id_category_default>0 AND po.`id_owner` = ' . $id_seller . ' ' . ($active ? ' AND p.`active` = 1' : '') . ' ' . $agile_sql_parts['wheres'] . ' '; if ($random === true) { $sql .= ' ORDER BY RAND()'; $sql .= ' LIMIT 0, ' . (int) $randomNumberProducts; } else { $sql .= ' ORDER BY ' . (isset($orderByPrefix) ? $orderByPrefix . '.' : '') . '`' . pSQL($orderBy) . '` ' . pSQL($orderWay) . ' LIMIT ' . ((int) $p - 1) * (int) $n . ',' . (int) $n; } $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); if ($orderBy == 'orderprice') { Tools::orderbyPrice($result, $orderWay); } if (!$result) { return false; } $finalResults = Product::getProductsProperties($id_lang, $result); $finalResults = AgileSellerManager::prepareSellerRattingInfo($finalResults); return $finalResults; }
public function getProducts($id_lang, $p, $n, $orderBy = NULL, $orderWay = NULL, $getTotal = false, $active = true, $random = false, $randomNumberProducts = 1, $checkAccess = true, Context $context = null) { global $cookie; if (!$checkAccess or !$this->checkAccess($cookie->id_customer)) { return false; } if (!$context) { $context = Context::getContext(); } $front = true; if (!in_array($context->controller->controller_type, array('front', 'modulefront'))) { $front = false; } if (Module::isInstalled('agilemembership') and $this->id == Configuration::get('AGILE_MEMBERSHIP_CID')) { return parent::getProducts($id_lang, $p, $n, $orderBy, $orderWay, $getTotal, $active, $random, $randomNumberProducts, $checkAccess); } if (Module::isInstalled('agileprepaidcredit') and $this->id == Configuration::getGlobalValue('AGILE_PCREDIT_CID')) { return parent::getProducts($id_lang, $p, $n, $orderBy, $orderWay, $getTotal, $active, $random, $randomNumberProducts, $checkAccess); } if (Module::isInstalled('agilesellerlistoptions') and $this->id == Configuration::get('ASLO_CATEGORY_ID')) { return parent::getProducts($id_lang, $p, $n, $orderBy, $orderWay, $getTotal, $active, $random, $randomNumberProducts, $checkAccess); } $agile_sql_parts = AgileSellerManager::getAdditionalSqlForProducts("p"); if (empty($agile_sql_parts['selects']) and empty($agile_sql_parts['joins']) and empty($agile_sql_parts['wheres'])) { return parent::getProducts($id_lang, $p, $n, $orderBy, $orderWay, $getTotal, $active, $random, $randomNumberProducts, $checkAccess); } if (Module::isInstalled('agilesellerlistoptions')) { require_once _PS_ROOT_DIR_ . "/modules/agilesellerlistoptions/agilesellerlistoptions.php"; if ($this->id <= 1 or $this->id == 2 or $this->id == (int) Configuration::get('PS_HOME_CATEGORY')) { return AgileSellerListOptions::get_home_products($id_lang, $p, $n); } if (empty($orderBy) || $orderBy == 'position') { $orderBy = 'position2'; } } if ($p < 1) { $p = 1; } if (empty($orderBy)) { $orderBy = 'position'; } else { $orderBy = strtolower($orderBy); } if (empty($orderWay)) { $orderWay = 'ASC'; } if ($orderBy == 'id_product' or $orderBy == 'date_add' or $orderBy == 'date_upd') { $orderByPrefix = 'p'; } elseif ($orderBy == 'name') { $orderByPrefix = 'pl'; } elseif ($orderBy == 'manufacturer') { $orderByPrefix = 'm'; $orderBy = 'name'; } elseif ($orderBy == 'position') { $orderByPrefix = 'cp'; } if ($orderBy == 'price') { $orderBy = 'orderprice'; } if (!Validate::isBool($active) or !Validate::isOrderBy($orderBy) or !Validate::isOrderWay($orderWay)) { die(Tools::displayError()); } $id_supplier = (int) Tools::getValue('id_supplier'); if ($getTotal) { $sql = ' SELECT COUNT(cp.`id_product`) AS total FROM `' . _DB_PREFIX_ . 'product` p ' . Shop::addSqlAssociation('product', 'p') . ' LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON p.`id_product` = cp.`id_product` ' . $agile_sql_parts['joins'] . ' WHERE cp.`id_category` = ' . (int) $this->id . ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '') . ($active ? ' AND product_shop.`active` = 1' : '') . $agile_sql_parts['wheres'] . ($id_supplier ? 'AND p.id_supplier = ' . (int) $id_supplier : ''); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); return isset($result) ? $result['total'] : 0; } $sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, MAX(product_attribute_shop.id_product_attribute) id_product_attribute, product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity, pl.`description`, pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` AS manufacturer_name, cl.`name` AS category_default, DATEDIFF(product_shop.`date_add`, DATE_SUB(NOW(), INTERVAL ' . (Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20) . ' DAY)) > 0 AS new, product_shop.price AS orderprice ' . $agile_sql_parts['selects'] . ' FROM `' . _DB_PREFIX_ . 'category_product` cp LEFT JOIN `' . _DB_PREFIX_ . 'product` p ON p.`id_product` = cp.`id_product` ' . Shop::addSqlAssociation('product', 'p') . ' LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON (p.`id_product` = pa.`id_product`) ' . Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1') . ' ' . Product::sqlStock('p', 'product_attribute_shop', false, $context->shop) . ' LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (product_shop.`id_category_default` = cl.`id_category` AND cl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('cl') . ') LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('pl') . ') LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (i.`id_product` = p.`id_product`)' . Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1') . ' LEFT JOIN `' . _DB_PREFIX_ . 'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = ' . (int) $id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer` ' . $agile_sql_parts['joins'] . ' WHERE product_shop.`id_shop` = ' . (int) $context->shop->id . ' ' . $agile_sql_parts['wheres'] . ' AND cp.`id_category` = ' . (int) $this->id . ($active ? ' AND product_shop.`active` = 1' : '') . ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '') . ($id_supplier ? ' AND p.id_supplier = ' . (int) $id_supplier : '') . ' GROUP BY product_shop.id_product'; if ($random === true) { $sql .= ' ORDER BY RAND()'; $sql .= ' LIMIT 0, ' . (int) $randomNumberProducts; } else { $sql .= ' ORDER BY ' . (isset($orderByPrefix) ? $orderByPrefix . '.' : '') . '`' . pSQL($orderBy) . '` ' . pSQL($orderWay) . ' LIMIT ' . ((int) $p - 1) * (int) $n . ',' . (int) $n; } $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); if (!$result) { return array(); } $seller = array(); $id_seller = array(); $link_seller = array(); foreach ($result as $row) { $pid = $row['id_product']; $seller[$pid] = isset($row['seller']) ? $row['seller'] : ''; $id_seller[$pid] = isset($row['id_seller']) ? intval($row['id_seller']) : 0; $link_seller[$pid] = isset($row['has_sellerlink']) ? $row['has_sellerlink'] : ''; } $resultsArray = Product::getProductsProperties((int) $id_lang, $result); for ($idx = 0; $idx < count($resultsArray); $idx++) { $pid = $resultsArray[$idx]['id_product']; $resultsArray[$idx]['seller'] = $seller[$pid]; $resultsArray[$idx]['id_seller'] = $id_seller[$pid]; $resultsArray[$idx]['has_sellerlink'] = $link_seller[$pid]; } $resultsArray = AgileSellerManager::prepareSellerRattingInfo($resultsArray); return $resultsArray; }
private function assign_entity_owner() { global $cookie; if (!Module::isInstalled('agilemultipleseller')) { return true; } if (isset($_GET['status' . $this->table])) { return true; } $eaccess = AgileSellerManager::get_entity_access($this->table); if ($eaccess['owner_table_type'] == AgileSellerManager::OWNER_TABLE_UNKNOWN) { return true; } include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/agilemultipleseller.php"; global $cookie; if (empty($eaccess['owner_xr_table'])) { $is_seller = $cookie->profile == (int) Configuration::get('AGILE_MS_PROFILE_ID'); if ($is_seller and (Tools::getValue('controller') == 'AdminCarrierWizard' or isset($_GET['submitAdd' . $this->table]) or isset($_POST['submitAdd' . $this->table]) or isset($_POST['submitAdd' . $this->table . 'AndStay']) or isset($_POST['import']) and $_POST['import'] = 1 and isset($_POST['csv']))) { $id_seller = $cookie->id_employee; } elseif (isset($_POST['id_seller'])) { $id_seller = intval($_POST['id_seller']); } else { $id_seller = 0; } AgileSellerManager::assignObjectOwner($this->table, $this->id, $id_seller); } return true; }
public static function IsProductInMedicalCategory($id_product) { $hjcigiv = "result"; $lstmhbaguh = "result"; ${"GLOBALS"}["rlyxqggizyx"] = "result"; ${"GLOBALS"}["ktxcrkcysi"] = "list"; ${${"GLOBALS"}["ixtqbqiuxlh"]} = implode(AgileSellerManager::get_all_children(Configuration::get("AGILE_MEDICAL_PRODUCT_CID")), ","); $ywugilyfsisi = "sql"; ${${"GLOBALS"}["fajsjwqsq"]} = "SELECT id_category from " . _DB_PREFIX_ . "category_product where id_category in (" . ${${"GLOBALS"}["ktxcrkcysi"]} . ") AND id_product =" . ${${"GLOBALS"}["jcoawuufl"]}; ${$hjcigiv} = Db::getInstance()->getRow(${$ywugilyfsisi}); if (isset(${$lstmhbaguh}["id_category"]) and intval(${${"GLOBALS"}["rlyxqggizyx"]}["id_category"]) > 0) { return true; } return false; }
public function getCMSLink($cms, $alias = null, $ssl = null, $id_lang = null, $id_shop = null, $relative_protocol = false) { if (!Module::isInstalled('agilemultipleshop')) { return parent::getCMSLink($cms, $alias = null, $ssl = null, $id_lang = null, $id_shop, $relative_protocol); } $url_choice_cms = (int) Configuration::get('ASP_URL_CHOICE_CMS'); if (!$id_lang) { $id_lang = Context::getContext()->language->id; } $id_seller = AgileSellerManager::getObjectOwnerID('cms', is_object($cms) ? $cms->id : (int) $cms); $url = $this->getAgileBaseUrl($url_choice_cms == 2, $id_seller, $ssl, $relative_protocol) . $this->getLangLink($id_lang, null, $id_shop); $dispatcher = Dispatcher::getInstance(); if (!is_object($cms)) { if ($alias !== null && !$dispatcher->hasKeyword('cms_rule', $id_lang, 'meta_keywords', $id_shop) && !$dispatcher->hasKeyword('cms_rule', $id_lang, 'meta_title', $id_shop)) { return $url . $dispatcher->createUrl('cms_rule', $id_lang, array('id' => (int) $cms, 'rewrite' => (string) $alias), $this->allow, '', $id_shop); } $cms = new CMS($cms, $id_lang); } $params = array(); $params['id'] = $cms->id; $params['rewrite'] = !$alias ? is_array($cms->link_rewrite) ? $cms->link_rewrite[(int) $id_lang] : $cms->link_rewrite : $alias; $params['meta_keywords'] = ''; if (isset($cms->meta_keywords) && !empty($cms->meta_keywords)) { $params['meta_keywords'] = is_array($cms->meta_keywords) ? Tools::str2url($cms->meta_keywords[(int) $id_lang]) : Tools::str2url($cms->meta_keywords); } $params['meta_title'] = ''; if (isset($cms->meta_title) && !empty($cms->meta_title)) { $params['meta_title'] = is_array($cms->meta_title) ? Tools::str2url($cms->meta_title[(int) $id_lang]) : Tools::str2url($cms->meta_title); } return $url . $dispatcher->createUrl('cms_rule', $id_lang, $params, $this->allow, '', $id_shop); }
public static function getXRObjectID($table, $objid) { $qjtuntb = "eaccess"; ${"GLOBALS"}["udhwfquxhsl"] = "xr_objid"; $hkubickdw = "eaccess"; ${$qjtuntb} = AgileSellerManager::get_entity_access(${${"GLOBALS"}["nezfvjcg"]}); ${"GLOBALS"}["vkhmrz"] = "xr_objid"; ${${"GLOBALS"}["vkhmrz"]} = intval(Tools::getValue("id_" . ${$hkubickdw}["owner_xr_table"])); if (${${"GLOBALS"}["udhwfquxhsl"]} == 0) { $yoihrfysgop = "sql"; ${"GLOBALS"}["vjihywdcwl"] = "sql"; ${"GLOBALS"}["uspxujlqtrl"] = "xr_objid"; ${$yoihrfysgop} = "SELECT id_" . ${${"GLOBALS"}["kcjdsssurq"]}["owner_xr_table"] . " FROM " . _DB_PREFIX_ . ${${"GLOBALS"}["nezfvjcg"]} . " WHERE id_" . ${${"GLOBALS"}["nezfvjcg"]} . "=" . ${${"GLOBALS"}["ehlykwtwk"]}; ${${"GLOBALS"}["uspxujlqtrl"]} = Db::getInstance()->getValue(${${"GLOBALS"}["vjihywdcwl"]}); } return ${${"GLOBALS"}["prsdhmrd"]}; }
protected function agilemultipleseller_list_override() { global $cookie; if (!Module::isInstalled('agilemultipleseller')) { return; } $eaccess = AgileSellerManager::get_entity_access($this->table); if ($eaccess['owner_table_type'] == AgileSellerManager::OWNER_TABLE_UNKNOWN) { return; } if ($eaccess['owner_table_type'] == AgileSellerManager::OWNER_TABLE_DEFINED) { if (empty($eaccess['owner_xr_table'])) { $this->_join = $this->_join . ' LEFT JOIN `' . _DB_PREFIX_ . $this->table . '_owner` ao ON (a.`id_' . $this->table . '`=ao.`id_' . $this->table . '`)'; } else { $this->_join = $this->_join . ' LEFT JOIN `' . _DB_PREFIX_ . $this->correct_table_name($eaccess['owner_xr_table']) . '`xr ON (a.`id_' . $eaccess['owner_xr_table'] . '`=xr.`id_' . $eaccess['owner_xr_table'] . '`)' . ' LEFT JOIN `' . _DB_PREFIX_ . $eaccess['owner_xr_table'] . '_owner` ao ON (xr.`id_' . $eaccess['owner_xr_table'] . '`=ao.`id_' . $eaccess['owner_xr_table'] . '`)'; } } else { if (empty($eaccess['owner_xr_table'])) { $this->_join = $this->_join . ' LEFT JOIN `' . _DB_PREFIX_ . 'object_owner` ao ON (a.`id_' . $this->table . '`=ao.`id_object` AND `entity`=\'' . $this->table . '\')'; } else { $this->_join = $this->_join . ' LEFT JOIN `' . _DB_PREFIX_ . $this->correct_table_name($eaccess['owner_xr_table']) . '`xr ON (a.`id_' . $eaccess['owner_xr_table'] . '`=xr.`id_' . $eaccess['owner_xr_table'] . '`)' . ' LEFT JOIN `' . _DB_PREFIX_ . 'object_owner` ao ON (xr.`id_' . $eaccess['owner_xr_table'] . '`=ao.`id_object` AND ao.`entity`= \'' . $eaccess['owner_xr_table'] . '\')'; } } $this->_join = $this->_join . ' LEFT JOIN `' . _DB_PREFIX_ . 'sellerinfo` ams ON (ao.`id_owner` = ams.`id_seller`)'; $this->_join = $this->_join . ' LEFT JOIN `' . _DB_PREFIX_ . 'sellerinfo_lang` amsl ON (ams.`id_sellerinfo` = amsl.`id_sellerinfo` AND amsl.id_lang=' . intval($cookie->id_lang) . ')'; if ($this->is_seller) { $cond_for_shared = 'OR IFNULL(ao.id_owner,0)=0'; if ($eaccess['is_exclusive']) { $cond_for_shared = ''; } $this->_where = $this->_where . ' AND (IFNULL(ao.id_owner,0)=' . intval($cookie->id_employee) . ' ' . $cond_for_shared . ')'; } else { $this->fields_list['seller'] = array('title' => $this->l('Seller'), 'width' => 90, 'filter_key' => 'amsl!company'); } }
${"GLOBALS"}["ibxcivfzq"] = "id_product"; ${"GLOBALS"}["xgstnxdbghr"] = "amodule"; ${"GLOBALS"}["hqbmibkbotjk"] = "cartProducts"; require_once dirname(__FILE__) . "/../../config/config.inc.php"; require_once dirname(__FILE__) . "/../../init.php"; require_once dirname(__FILE__) . "/agilemultipleseller.php"; ${"GLOBALS"}["esxaacg"] = "cartProducts"; $ybpyjoj = "cart"; header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); if (!${$ybpyjoj}) { return; } if (intval(Configuration::get("AGILE_MS_CART_MODE")) == AgileMultipleSeller::CART_MODE_MULTIPLE_SELLER) { die("OK"); } ${${"GLOBALS"}["hqbmibkbotjk"]} = $cart->getProducts(); if (empty(${${"GLOBALS"}["esxaacg"]})) { die("OK"); } ${"GLOBALS"}["pdipnbsi"] = "product"; ${${"GLOBALS"}["xgstnxdbghr"]} = new AgileMultipleSeller(); ${${"GLOBALS"}["ibxcivfzq"]} = intval(Tools::getValue("id_product")); ${${"GLOBALS"}["qzpehthyxv"]} = AgileSellerManager::getObjectOwnerID("product", ${${"GLOBALS"}["ibxcivfzq"]}); foreach (${${"GLOBALS"}["hqbmibkbotjk"]} as ${${"GLOBALS"}["pdipnbsi"]}) { ${"GLOBALS"}["exmfcqtbvsst"] = "id_owner"; ${${"GLOBALS"}["lwovhblqe"]} = AgileSellerManager::getObjectOwnerID("product", ${${"GLOBALS"}["kcrxatzs"]}["id_product"]); if (${${"GLOBALS"}["lwovhblqe"]} != ${${"GLOBALS"}["exmfcqtbvsst"]}) { die($amodule->getL("ProductIsFromDifferentSellerInCart")); } } die("OK");
public static function searchTag($id_lang, $tag, $count = false, $pageNumber = 0, $pageSize = 10, $orderBy = false, $orderWay = false, $useCookie = true, Context $context = null) { if (!$context) { $context = Context::getContext(); } if (!Module::isInstalled('agilemultipleseller') and !Module::isInstalled('agilesellerlistoptions')) { return parent::searchTag($id_lang, $expr, $pageNumber, $pageSize, $orderBy, $orderWay, $ajax, $useCookie, $context); } $agile_sql_parts = AgileSellerManager::getAdditionalSqlForProducts("p"); if ($useCookie) { $id_customer = (int) $context->customer->id; } else { $id_customer = 0; } if (!is_numeric($pageNumber) || !is_numeric($pageSize) || !Validate::isBool($count) || !Validate::isValidSearch($tag) || $orderBy && !$orderWay || $orderBy && !Validate::isOrderBy($orderBy) || $orderWay && !Validate::isOrderBy($orderWay)) { return false; } if ($pageNumber < 1) { $pageNumber = 1; } if ($pageSize < 1) { $pageSize = 10; } $id = Context::getContext()->shop->id; $id_shop = $id ? $id : Configuration::get('PS_SHOP_DEFAULT'); if ($count) { $sql = 'SELECT COUNT(DISTINCT pt.`id_product`) nb FROM `' . _DB_PREFIX_ . 'product` p ' . $agile_sql_parts['joins'] . ' ' . Shop::addSqlAssociation('product', 'p') . ' LEFT JOIN `' . _DB_PREFIX_ . 'product_tag` pt ON (p.`id_product` = pt.`id_product`) LEFT JOIN `' . _DB_PREFIX_ . 'tag` t ON (pt.`id_tag` = t.`id_tag` AND t.`id_lang` = ' . (int) $id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.`id_product` = p.`id_product`) LEFT JOIN `' . _DB_PREFIX_ . 'category_shop` cs ON (cp.`id_category` = cs.`id_category` AND cs.`id_shop` = ' . (int) $id_shop . ') LEFT JOIN `' . _DB_PREFIX_ . 'category_group` cg ON (cg.`id_category` = cp.`id_category`) WHERE product_shop.`active` = 1 ' . $agile_sql_parts['wheres'] . ' AND cs.`id_shop` = ' . (int) Context::getContext()->shop->id . ' AND cg.`id_group` ' . (!$id_customer ? '= ' . (int) Configuration::get('PS_UNIDENTIFIED_GROUP') : 'IN ( SELECT id_group FROM ' . _DB_PREFIX_ . 'customer_group WHERE id_customer = ' . (int) $id_customer . ')') . ' AND t.`name` LIKE \'%' . pSQL($tag) . '%\''; return (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); } $sql = 'SELECT DISTINCT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description_short`, pl.`link_rewrite`, pl.`name`, MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` manufacturer_name, 1 position, DATEDIFF( p.`date_add`, DATE_SUB( NOW(), INTERVAL ' . (Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20) . ' DAY ) ) > 0 new ' . $agile_sql_parts['selects'] . ' FROM `' . _DB_PREFIX_ . 'product` p ' . $agile_sql_parts['joins'] . ' INNER JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON ( p.`id_product` = pl.`id_product` AND pl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('pl') . ' ) ' . Shop::addSqlAssociation('product', 'p', false) . ' LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (i.`id_product` = p.`id_product`)' . Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1') . ' LEFT JOIN `' . _DB_PREFIX_ . 'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = ' . (int) $id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`) LEFT JOIN `' . _DB_PREFIX_ . 'product_tag` pt ON (p.`id_product` = pt.`id_product`) LEFT JOIN `' . _DB_PREFIX_ . 'tag` t ON (pt.`id_tag` = t.`id_tag` AND t.`id_lang` = ' . (int) $id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.`id_product` = p.`id_product`) LEFT JOIN `' . _DB_PREFIX_ . 'category_group` cg ON (cg.`id_category` = cp.`id_category`) LEFT JOIN `' . _DB_PREFIX_ . 'category_shop` cs ON (cg.`id_category` = cs.`id_category` AND cs.`id_shop` = ' . (int) $id_shop . ') ' . Product::sqlStock('p', 0) . ' WHERE product_shop.`active` = 1 ' . $agile_sql_parts['wheres'] . ' AND cs.`id_shop` = ' . (int) Context::getContext()->shop->id . ' AND cg.`id_group` ' . (!$id_customer ? '= ' . (int) Configuration::get('PS_UNIDENTIFIED_GROUP') : 'IN ( SELECT id_group FROM ' . _DB_PREFIX_ . 'customer_group WHERE id_customer = ' . (int) $id_customer . ')') . ' AND t.`name` LIKE \'%' . pSQL($tag) . '%\' GROUP BY product_shop.id_product ORDER BY position DESC' . ($orderBy ? ', ' . $orderBy : '') . ($orderWay ? ' ' . $orderWay : '') . ' LIMIT ' . (int) (($pageNumber - 1) * $pageSize) . ',' . (int) $pageSize; if (!($result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql))) { return false; } $results = Product::getProductsProperties((int) $id_lang, $result); $results = AgileSellerManager::prepareSellerRattingInfo($results); return $results; }
private function getTotalAmountOfSeller($products, $id_seller) { $total = 0; foreach ($products as $key => $product) { $id_owner = intval(AgileSellerManager::getObjectOwnerID('product', $product['id_product'])); if ($id_seller != $id_owner) { continue; } $total += $product['price_wt'] * $product['cart_quantity']; } return $total; }