Esempio n. 1
0
 function getList($groupordering = 0, $order = null, $orderDir = null, $filter = array())
 {
     $db = JFactory::getDBO();
     $lang = JSFactory::getLang();
     $ordering = "F.ordering";
     if ($order && $orderDir) {
         $ordering = $order . " " . $orderDir;
     }
     if ($groupordering) {
         $ordering = "G.ordering, " . $ordering;
     }
     $where = '';
     $_where = array();
     if ($filter['group']) {
         $_where[] = " F.group = '" . $db->escape($filter['group']) . "' ";
     }
     if ($filter['text_search']) {
         $text_search = $filter['text_search'];
         $word = addcslashes($db->escape($text_search), "_%");
         $_where[] = "(LOWER(F.`" . $lang->get('name') . "`) LIKE '%" . $word . "%' OR LOWER(F.`" . $lang->get('description') . "`) LIKE '%" . $word . "%' OR F.id LIKE '%" . $word . "%')";
     }
     if (count($_where) > 0) {
         $where = " WHERE " . implode(" AND ", $_where);
     }
     $query = "SELECT F.id, F.`" . $lang->get("name") . "` as name, F.`" . $lang->get("description") . "` as description, F.allcats, F.type, F.cats, F.ordering, F.`group`, G.`" . $lang->get("name") . "` as groupname, multilist FROM `#__jshopping_products_extra_fields` as F left join `#__jshopping_products_extra_field_groups` as G on G.id=F.group " . $where . " order by " . $ordering;
     $db->setQuery($query);
     return $db->loadObjectList();
 }
 function getName($status_id)
 {
     $lang = JSFactory::getLang();
     $query = "SELECT `" . $lang->get('name') . "` as name FROM `#__jshopping_order_status` WHERE status_id = '" . $this->_db->escape($status_id) . "'";
     $this->_db->setQuery($query);
     return $this->_db->loadResult();
 }
 function getAllList($display = 0)
 {
     $db = JFactory::getDBO();
     $lang = JSFactory::getLang();
     $query = "SELECT id, `" . $lang->get("name") . "` as name, field_id FROM `#__jshopping_products_extra_field_values` order by ordering";
     extract(js_add_trigger(get_defined_vars(), "before"));
     $db->setQuery($query);
     if ($display == 0) {
         return $db->loadObjectList();
     } elseif ($display == 1) {
         $rows = $db->loadObjectList();
         $list = array();
         foreach ($rows as $k => $row) {
             $list[$row->id] = $row->name;
             unset($rows[$k]);
         }
         return $list;
     } else {
         $rows = $db->loadObjectList();
         $list = array();
         foreach ($rows as $k => $row) {
             $list[$row->field_id][$row->id] = $row->name;
             unset($rows[$k]);
         }
         return $list;
     }
 }
Esempio n. 4
0
 public static function getCategory($catid, $order = 'id', $ordering = 'asc', $limit, $publish = 0)
 {
     $_db = JFactory::getDBO();
     $lang = JSFactory::getLang();
     $user = JFactory::getUser();
     $add_where = $publish ? " AND category_publish = '1' " : "";
     $groups = implode(',', $user->getAuthorisedViewLevels());
     $add_where .= ' AND access IN (' . $groups . ')';
     if ($order == "id") {
         $orderby = "category_id";
     }
     if ($order == "name") {
         $orderby = "`" . $lang->get('name') . "`";
     }
     if ($order == "ordering") {
         $orderby = "ordering";
     }
     if (!$orderby) {
         $orderby = "ordering";
     }
     if ($limit > 0) {
         $_limit = " LIMIT 0 , " . $limit;
     } else {
         $_limit = "";
     }
     $query = "SELECT `" . $lang->get('name') . "` as name,`" . $lang->get('description') . "` as description,`" . $lang->get('short_description') . "` as short_description, category_id, category_publish, ordering, category_image FROM `#__jshopping_categories`\r\n                   WHERE category_id IN (" . $catid . ") " . $add_where . "\r\n                   ORDER BY " . $orderby . " " . $ordering . " " . $_limit;
     $_db->setQuery($query);
     $categories = $_db->loadObjectList();
     foreach ($categories as $key => $value) {
         $categories[$key]->link = SEFLink('index.php?option=com_jshopping&controller=category&task=view&category_id=' . $categories[$key]->category_id, 1);
     }
     return $categories;
 }
 function save()
 {
     $id = JRequest::getInt("id");
     $configdisplayprice = JSFactory::getTable('configDisplayPrice', 'jshop');
     $post = JRequest::get("post");
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeSaveConfigDisplayPrice', array(&$post));
     if (!$post['countries_id']) {
         JError::raiseWarning("", _JSHOP_ERROR_BIND);
         $this->setRedirect("index.php?option=com_jshopping&controller=configdisplayprice&task=edit&id=" . $post['id']);
         return 0;
     }
     if (!$configdisplayprice->bind($post)) {
         JError::raiseWarning("", _JSHOP_ERROR_BIND);
         $this->setRedirect("index.php?option=com_jshopping&controller=configdisplayprice");
         return 0;
     }
     $configdisplayprice->setZones($post['countries_id']);
     if (!$configdisplayprice->store()) {
         JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
         $this->setRedirect("index.php?option=com_jshopping&controller=configdisplayprice");
         return 0;
     }
     updateCountConfigDisplayPrice();
     $dispatcher->trigger('onAftetSaveConfigDisplayPrice', array(&$configdisplayprice));
     if ($this->getTask() == 'apply') {
         $this->setRedirect("index.php?option=com_jshopping&controller=configdisplayprice&task=edit&id=" . $configdisplayprice->id);
     } else {
         $this->setRedirect("index.php?option=com_jshopping&controller=configdisplayprice");
     }
 }
Esempio n. 6
0
 function display($cachable = false, $urlparams = false)
 {
     $mainframe = JFactory::getApplication();
     $context = "jshoping.list.admin.coupons";
     $limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0, 'int');
     $filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', "C.coupon_code", 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', "asc", 'cmd');
     $jshopConfig = JSFactory::getConfig();
     $coupons = $this->getModel("coupons");
     $total = $coupons->getCountCoupons();
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $rows = $coupons->getAllCoupons($pageNav->limitstart, $pageNav->limit, $filter_order, $filter_order_Dir);
     $currency = JTable::getInstance('currency', 'jshop');
     $currency->load($jshopConfig->mainCurrency);
     $view = $this->getView("coupons", 'html');
     $view->setLayout("list");
     $view->assign('rows', $rows);
     $view->assign('currency', $currency->currency_code);
     $view->assign('pageNav', $pageNav);
     $view->assign('filter_order', $filter_order);
     $view->assign('filter_order_Dir', $filter_order_Dir);
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplayCoupons', array(&$view));
     $view->displayList();
 }
Esempio n. 7
0
 /**
  * get list country
  * 
  * @param int $publish (0-all, 1-publish, 2-unpublish)
  * @param int $limitstart
  * @param int $limit
  * @param int $orderConfig use order config
  * @return array
  */
 function getAllCountries($publish = 1, $limitstart = null, $limit = null, $orderConfig = 1, $order = null, $orderDir = null)
 {
     $db = JFactory::getDBO();
     $jshopConfig = JSFactory::getConfig();
     if ($publish == 0) {
         $where = " ";
     } else {
         if ($publish == 1) {
             $where = " WHERE country_publish = '1' ";
         } else {
             if ($publish == 2) {
                 $where = " WHERE country_publish = '0' ";
             }
         }
     }
     $ordering = "ordering";
     if ($orderConfig && $jshopConfig->sorting_country_in_alphabet) {
         $ordering = "name";
     }
     if ($order && $orderDir) {
         $ordering = $order . " " . $orderDir;
     }
     $lang = JSFactory::getLang();
     $query = "SELECT country_id, country_publish, ordering, country_code, country_code_2, `" . $lang->get("name") . "` as name FROM `#__jshopping_countries` " . $where . " ORDER BY " . $ordering;
     $db->setQuery($query, $limitstart, $limit);
     return $db->loadObjectList();
 }
 private function getFreightPrice($weight, $type)
 {
     $vendor = JSFactory::getTable('vendor', 'jshop');
     $vendor->loadMain();
     $client = JSFactory::getUser();
     $cep = preg_replace('|[^\\d]|', '', $client->d_zip ? $client->d_zip : $client->zip);
     $cost = $this->getCache($weight, $type, $cep);
     if ($cost) {
         return $cost;
     }
     $data = array('email' => plgSystemLigminchaFreight::$pagseguro_email, 'token' => plgSystemLigminchaFreight::$pagseguro_token, 'currency' => 'BRL', 'itemId1' => 1, 'itemDescription1' => 'Livros do Ligmincha Brasil Loja', 'itemAmount1' => '1.00', 'itemQuantity1' => 1, 'itemWeight1' => $weight, 'reference' => strtoupper(substr(uniqid('LB'), 1, 6)), 'senderName' => $vendor->shop_name, 'senderAreaCode' => $vendor->zip, 'senderEmail' => $vendor->email, 'shippingType' => $type, 'shippingAddressStreet' => $client->d_street ? $client->d_street : $client->street, 'shippingAddressNumber' => $client->d_street_nr ? $client->d_street_nr : $client->street_nr, 'shippingAddressPostalCode' => $cep, 'shippingAddressCity' => $client->d_city ? $client->d_city : $client->city, 'shippingAddressState' => $client->d_state ? $client->d_state : $client->state, 'shippingAddressCountry' => 'BRA');
     $result = $this->post('https://ws.pagseguro.uol.com.br/v2/checkout/', $data);
     $code = preg_match('|<code>(.+?)</code>|', $result, $m) ? $m[1] : false;
     if ($code) {
         JFactory::getApplication()->enqueueMessage("Code: {$code}");
         $html = file_get_contents("https://pagseguro.uol.com.br/v2/checkout/payment.html?code={$code}");
         $cost = preg_match('|"freightRow".+?R\\$.+?([\\d,]+)|s', $html, $m) ? $m[1] : 0;
         $cost = str_replace(',', '.', $cost);
     } else {
         JError::raiseWarning('', curl_error($result));
     }
     if ($cost == 0) {
         JError::raiseWarning('', 'Failed to obtain freight price!');
     } else {
         $this->setCache($weight, $type, $cep, $cost);
     }
     return $cost;
 }
 function showEndForm($pmconfigs, $order)
 {
     $jshopConfig = JSFactory::getConfig();
     $pm_method = $this->getPmMethod();
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->clear();
     $query->update('#__jshopping_orders')->set($db->quoteName('order_created') . ' = 1 ')->where($db->quoteName('order_id') . ' = ' . (int) $order->order_id);
     $db->setQuery($query);
     echo '<div id="begateway_erip">';
     try {
         $db->execute();
         $model = JSFactory::getModel('orderMail', 'jshop');
         $model->setData($order->order_id, 0);
         $model->send();
         if ($pmconfigs['auto'] == '1') {
             JPluginHelper::importPlugin('PlgSystemJoomShoppingErip');
             $dispatcher = JEventDispatcher::getInstance();
             $result = $dispatcher->trigger('onBeforeChangeOrderStatusAdmin', array($order->order_id, $this->getStatusId(), 'auto'));
             if (!$result) {
                 throw new Exception(JText::_('PLG_JSERIPPAYMENT_ORDER_ERROR'));
             }
             $instruction = JText::_('PLG_JSERIPPAYMENT_ERIP_INSTRUCTION');
             $instruction = str_replace('#TABS#', '<strong>' . $pmconfigs['tree_path_email'] . '</strong>', $instruction);
             $instruction = str_replace('#ORDER_ID#', '<strong>' . $order->order_id . '</strong>', $instruction);
             echo nl2br($instruction);
         } else {
             echo nl2br(JText::_('PLG_JSERIPPAYMENT_ORDER_CONFIRMATION'));
         }
     } catch (RuntimeException $e) {
         echo JText::_('PLG_JSERIPPAYMENT_ORDER_ERROR');
     }
     echo '</div>';
 }
Esempio n. 10
0
 function showEndForm($pmconfigs, $order)
 {
     $mainframe =& JFactory::getApplication();
     $jshopConfig =& JSFactory::getConfig();
     $item_name = sprintf(_JSHOP_PAYMENT_NUMBER, $order->order_number);
     $notify_url = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=notify&js_paymentclass=pm_ideal&no_lang=1";
     $return = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=return&js_paymentclass=pm_ideal";
     $cancel_return = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=cancel&js_paymentclass=pm_ideal";
     $params_data = $order->getPaymentParamsData();
     $bank_id = $params_data['bank_id'];
     $amount = intval($order->order_total * 100);
     $iDEAL = new iDEAL_Payment($pmconfigs['partnerid']);
     if ($pmconfigs['testmode']) {
         $iDEAL->setTestMode();
     }
     if ($iDEAL->createPayment($bank_id, $amount, $item_name, $return, $notify_url)) {
         $order1 =& JTable::getInstance('order', 'jshop');
         $order1->load($order->order_id);
         $order1->transaction = $iDEAL->getTransactionId();
         $order1->store();
         header("Location: " . $iDEAL->getBankURL());
         exit;
     } else {
         saveToLog("payment.log", "Error: Order ID " . $order->order_id . ". CODE: " . $iDEAL->getErrorCode() . ". MSG: " . $iDEAL->getErrorMessage());
         JError::raiseWarning("", $iDEAL->getErrorMessage());
         $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5', 0, 1, $jshopConfig->use_ssl));
         exit;
     }
 }
Esempio n. 11
0
 function display($cachable = false, $urlparams = false)
 {
     $jshopConfig = JSFactory::getConfig();
     $mainframe = JFactory::getApplication();
     $context = "jshoping.list.admin.currencies";
     $filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', "currency_ordering", 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', "asc", 'cmd');
     $current_currency = JTable::getInstance('currency', 'jshop');
     $current_currency->load($jshopConfig->mainCurrency);
     if ($current_currency->currency_value != 1) {
         JError::raiseWarning("", _JSHOP_ERROR_MAIN_CURRENCY_VALUE);
     }
     $currencies = $this->getModel("currencies");
     $rows = $currencies->getAllCurrencies(0, $filter_order, $filter_order_Dir);
     $view = $this->getView("currencies", 'html');
     $view->setLayout("list");
     $view->assign('rows', $rows);
     $view->assign('config', $jshopConfig);
     $view->assign('filter_order', $filter_order);
     $view->assign('filter_order_Dir', $filter_order_Dir);
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplayCourencies', array(&$view));
     $view->displayList();
 }
 function addTitleHead()
 {
     $jshopConfig = JSFactory::getConfig();
     $vendorinfo = $this->_vendorinfo;
     $this->Image($jshopConfig->path . 'images/header.jpg', 1, 1, $jshopConfig->pdf_header_width, $jshopConfig->pdf_header_height);
     # $this->Image($jshopConfig->path.'images/footer.jpg',1,265,$jshopConfig->pdf_footer_width,$jshopConfig->pdf_footer_height);
 }
Esempio n. 13
0
 function getAllLanguages($publish = 1)
 {
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     $where_add = $publish ? "where `publish`='1'" : "";
     $query = "SELECT * FROM `#__jshopping_languages` " . $where_add . " order by `ordering`";
     extract(js_add_trigger(get_defined_vars(), "before"));
     $db->setQuery($query);
     $rowssort = array();
     $rows = $db->loadObjectList();
     foreach ($rows as $k => $v) {
         $rows[$k]->lang = substr($v->language, 0, 2);
         if ($jshopConfig->cur_lang == $v->language) {
             $rowssort[] = $rows[$k];
         }
     }
     foreach ($rows as $k => $v) {
         if (isset($rowssort[0]) && $rowssort[0]->language == $v->language) {
             continue;
         }
         $rowssort[] = $v;
     }
     unset($rows);
     return $rowssort;
 }
 function showAdminFormParams($params)
 {
     JSFactory::loadExtLanguageFile("pm_saferpay");
     $orders =& JModel::getInstance('orders', 'JshoppingModel');
     //admin model
     include dirname(__FILE__) . "/adminparamsform.php";
 }
Esempio n. 15
0
 function save()
 {
     $mainframe = JFactory::getApplication();
     $id = JRequest::getInt("id");
     $deliveryTimes = JSFactory::getTable('deliveryTimes', 'jshop');
     $post = JRequest::get("post");
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeSaveDeliveryTime', array(&$post));
     if (!$deliveryTimes->bind($post)) {
         JError::raiseWarning("", _JSHOP_ERROR_BIND);
         $this->setRedirect("index.php?option=com_jshopping&controller=deliverytimes");
         return 0;
     }
     if (!$deliveryTimes->store()) {
         JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
         $this->setRedirect("index.php?option=com_jshopping&controller=deliverytimes");
         return 0;
     }
     $dispatcher->trigger('onAfterSaveDeliveryTime', array(&$deliveryTimes));
     if ($this->getTask() == 'apply') {
         $this->setRedirect("index.php?option=com_jshopping&controller=deliverytimes&task=edit&id=" . $deliveryTimes->id);
     } else {
         $this->setRedirect("index.php?option=com_jshopping&controller=deliverytimes");
     }
 }
Esempio n. 16
0
 function display($cachable = false, $urlparams = false)
 {
     $jshopConfig = JSFactory::getConfig();
     $position = JRequest::getInt('position');
     $filter = JRequest::getVar('filter');
     $path_length = strlen($jshopConfig->image_product_path) + 1;
     $html = "<div class='images_list_search'><input type='text' id='filter_product_image_name' value='" . $filter . "'> <input type='button' value='" . _JSHOP_SEARCH . "' onclick='product_images_request(" . $position . ", \"index.php?option=com_jshopping&controller=product_images&task=display\", jQuery(\"#filter_product_image_name\").val())'></div>";
     $html .= '<div class="images_list">';
     foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($jshopConfig->image_product_path), RecursiveIteratorIterator::SELF_FIRST) as $v) {
         $filename = substr($v, $path_length);
         if ($filter != '' && !substr_count($filename, $filter)) {
             continue;
         }
         if (file_exists($jshopConfig->image_product_path . '/' . 'thumb_' . $filename)) {
             $html .= '<div class="one_image">';
             $html .= '<table>';
             $html .= '<tr><td align="center" valign="middle"><div>';
             $html .= $this->_getLinkForImage('<img alt="" title="' . $filename . '" src="' . $jshopConfig->image_product_live_path . '/thumb_' . $filename . '"/>', $filename);
             $html .= '</div></td></tr>';
             $html .= '<tr><td valign="bottom" align="center"><div>';
             $html .= $this->_getLinkForImage($filename, $filename);
             $html .= '</div></td></tr>';
             $html .= '</table>';
             $html .= '</div>';
         }
     }
     $html .= '<div style="clear: both"></div>';
     $html .= '</div>';
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeDisplayProductsImagesHTML', array(&$html));
     echo $html;
     die;
 }
Esempio n. 17
0
 private function updateUserGroup()
 {
     $user = JFactory::getUser();
     if (!$user->guest) {
         $from_summ_1 = $this->params->get('from_summ_1', 0);
         $to_summ_1 = $this->params->get('to_summ_1', 0);
         $group_id_1 = $this->params->get('group_id_1', 0);
         $from_summ_2 = $this->params->get('from_summ_2', 0);
         $to_summ_2 = $this->params->get('to_summ_2', 0);
         $group_id_2 = $this->params->get('group_id_2', 0);
         if ($from_summ_1 != 0 && $to_summ_1 != 0 && $group_id_1 != 0 || $from_summ_2 != 0 && $to_summ_2 != 0 && $group_id_2 != 0) {
             $db = JFactory::getDBO();
             $order = JSFactory::getTable('order', 'jshop');
             $orders = $order->getOrdersForUser($user->id);
             $total = 0;
             foreach ($orders as $order) {
                 $total += $order->order_total;
             }
             $this->groupIsPresent($db, 3);
             if ($total >= $from_summ_1 && $total <= $to_summ_1) {
                 if ($this->groupIsPresent($db, $group_id_1)) {
                     $this->setNewGroupId($db, $group_id_1, $user->id);
                 }
                 //}	elseif($total >= $from_summ_2 && $total <= $to_summ_2) {
             } else {
                 if ($this->groupIsPresent($db, $group_id_2)) {
                     $this->setNewGroupId($db, $group_id_2, $user->id);
                 }
                 //}	elseif($total >= $from_summ_2 && $total <= $to_summ_2) {
             }
             setNextUpdatePrices();
         }
     }
 }
Esempio n. 18
0
 function getProductFieldSorting($order)
 {
     if ($order == 4) {
         $order = 1;
     }
     return JSFactory::getConfig()->sorting_products_field_s_select[$order];
 }
Esempio n. 19
0
 function getDisplayPriceFront()
 {
     $display_price = $this->display_price_front;
     if ($this->use_extend_display_price_rule > 0) {
         $adv_user = JSFactory::getUserShop();
         $country_id = $adv_user->country;
         $client_type = $adv_user->client_type;
         if (!$adv_user->user_id) {
             $adv_user = JSFactory::getUserShopGuest();
             $country_id = $adv_user->country;
             $client_type = $adv_user->client_type;
         }
         if (!$country_id) {
             $country_id = $this->default_country;
         }
         if ($country_id) {
             $configDisplayPrice = JSFactory::getTable('configDisplayPrice', 'jshop');
             $rows = $configDisplayPrice->getList();
             foreach ($rows as $v) {
                 if (in_array($country_id, $v->countries)) {
                     if ($client_type == 2) {
                         $display_price = $v->display_price_firma;
                     } else {
                         $display_price = $v->display_price;
                     }
                 }
             }
         }
     }
     return $display_price;
 }
 function start()
 {
     $jshopConfig = JSFactory::getConfig();
     $key = JRequest::getVar("key");
     if ($key != $jshopConfig->securitykey) {
         die;
     }
     $_GET['noredirect'] = 1;
     $_POST['noredirect'] = 1;
     $_REQUEST['noredirect'] = 1;
     $db = JFactory::getDBO();
     $time = time();
     $query = "SELECT * FROM `#__jshopping_import_export` where `steptime`>0 and (endstart + steptime < {$time})  ORDER BY id";
     $db->setQuery($query);
     $list = $db->loadObjectList();
     foreach ($list as $ie) {
         $alias = $ie->alias;
         if (!file_exists(JPATH_COMPONENT_ADMINISTRATOR . "/importexport/" . $alias . "/" . $alias . ".php")) {
             print sprintf(_JSHOP_ERROR_FILE_NOT_EXIST, "/importexport/" . $alias . "/" . $alias . ".php");
             return 0;
         }
         include_once JPATH_COMPONENT_ADMINISTRATOR . "/importexport/" . $alias . "/" . $alias . ".php";
         $classname = 'Ie' . $alias;
         $controller = new $classname($ie->id);
         $controller->set('ie_id', $ie->id);
         $controller->set('alias', $alias);
         $controller->save();
         print $alias . "\n";
     }
     die;
 }
 function addTitleHead()
 {
     $jshopConfig = JSFactory::getConfig();
     $vendorinfo = $this->_vendorinfo;
     $this->Image($jshopConfig->path . 'images/header.jpg', 1, 1, $jshopConfig->pdf_header_width, $jshopConfig->pdf_header_height);
     $this->Image($jshopConfig->path . 'images/footer.jpg', 1, 265, $jshopConfig->pdf_footer_width, $jshopConfig->pdf_footer_height);
     $this->SetFont('freesans', '', 8);
     $this->SetXY(115, 12);
     $this->SetTextColor($this->pdfcolors[2][0], $this->pdfcolors[2][1], $this->pdfcolors[2][2]);
     $_vendor_info = array();
     $_vendor_info[] = $vendorinfo->adress;
     $_vendor_info[] = $vendorinfo->zip . " " . $vendorinfo->city;
     if ($vendorinfo->phone) {
         $_vendor_info[] = _JSHOP_CONTACT_PHONE . ": " . $vendorinfo->phone;
     }
     if ($vendorinfo->fax) {
         $_vendor_info[] = _JSHOP_CONTACT_FAX . ": " . $vendorinfo->fax;
     }
     if ($vendorinfo->email) {
         $_vendor_info[] = _JSHOP_EMAIL . ": " . $vendorinfo->email;
     }
     $str_vendor_info = implode("\n", $_vendor_info);
     $this->MultiCell(80, 3, $str_vendor_info, 0, 'R');
     $this->SetTextColor($this->pdfcolors[0][0], $this->pdfcolors[0][1], $this->pdfcolors[0][2]);
 }
Esempio n. 22
0
 function edit()
 {
     $jshopConfig = JSFactory::getConfig();
     $shipping_id = JRequest::getInt("shipping_id");
     $shipping = JTable::getInstance('shippingMethod', 'jshop');
     $shipping->load($shipping_id);
     $edit = $shipping_id ? $edit = 1 : ($edit = 0);
     $_lang = $this->getModel("languages");
     $languages = $_lang->getAllLanguages(1);
     $multilang = count($languages) > 1;
     $_payments = $this->getModel("payments");
     $list_payments = $_payments->getAllPaymentMethods(0);
     $lists['payments'] = JHTML::_('select.genericlist', $list_payments, 'listpayments[]', 'class="inputbox" size="10" multiple = "multiple"', 'payment_id', 'name', $shipping->getPayments());
     $nofilter = array();
     JFilterOutput::objectHTMLSafe($shipping, ENT_QUOTES, $nofilter);
     $view = $this->getView("shippings", 'html');
     $view->setLayout("edit");
     $view->assign('shipping', $shipping);
     $view->assign('edit', $edit);
     $view->assign('languages', $languages);
     $view->assign('multilang', $multilang);
     $view->assign('lists', $lists);
     $view->assign('config', $jshopConfig);
     $view->assign('etemplatevar', '');
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeEditShippings', array(&$view));
     $view->displayEdit();
 }
 function fetchElement()
 {
     require_once JPATH_SITE . "/components/com_jshopping/lib/factory.php";
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     $lang = JFactory::getLanguage()->getTag();
     $query = "SELECT m.category_id AS id, IF(`name_{$lang}`<>'',`name_{$lang}`,`name_" . $jshopConfig->frontend_lang . "`) AS title, IF(`name_{$lang}`<>'',`name_{$lang}`,`name_" . $jshopConfig->frontend_lang . "`) AS name, m.category_parent_id AS parent_id, m.category_parent_id as parent\n              FROM #__jshopping_categories AS m\n              LEFT JOIN #__jshopping_products_to_categories AS f\n              ON m.category_id = f.category_id\n              WHERE m.category_publish = 1\n              ORDER BY ordering";
     $db->setQuery($query);
     $menuItems = $db->loadObjectList();
     $children = array();
     if ($menuItems) {
         foreach ($menuItems as $v) {
             $pt = $v->parent_id;
             $list = isset($children[$pt]) ? $children[$pt] : array();
             array_push($list, $v);
             $children[$pt] = $list;
         }
     }
     jimport('joomla.html.html.menu');
     $options = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
     $this->_xml->addChild('option', 'Root')->addAttribute('value', 0);
     $optgroup = $this->_xml->addChild('optgroup', '');
     $optgroup->addAttribute('label', 'Categories');
     if (count($options)) {
         foreach ($options as $option) {
             $optgroup->addChild('option', htmlspecialchars($option->treename))->addAttribute('value', $option->id);
         }
     }
     $this->_value = $this->_form->get($this->_name, $this->_default);
     $html = parent::fetchElement();
     return $html;
 }
Esempio n. 24
0
 private function loadOrderLink()
 {
     $jshopConfig = JSFactory::getConfig();
     foreach ($this->list as $key => $value) {
         $this->list[$key]->order_href = SEFLink('index.php?option=com_jshopping&controller=user&task=order&order_id=' . $value->order_id, 0, 0, $jshopConfig->use_ssl);
     }
 }
Esempio n. 25
0
 function save()
 {
     $apply = JRequest::getVar("apply");
     $vendor = JTable::getInstance('vendor', 'jshop');
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $id = JRequest::getInt("id");
     $vendor->load($id);
     if (!isset($_POST['publish'])) {
         $_POST['publish'] = 0;
     }
     $post = JRequest::get("post");
     $dispatcher->trigger('onBeforeSaveVendor', array(&$post));
     $vendor->bind($post);
     JSFactory::loadLanguageFile();
     if (!$vendor->check()) {
         JError::raiseWarning("", $vendor->getError());
         $this->setRedirect("index.php?option=com_jshopping&controller=vendors&task=edit&id=" . $vendor->id);
         return 0;
     }
     if (!$vendor->store()) {
         JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
         $this->setRedirect("index.php?option=com_jshopping&controller=vendors&task=edit&id=" . $vendor->id);
         return 0;
     }
     $dispatcher->trigger('onAfterSaveVendor', array(&$vendor));
     if ($this->getTask() == 'apply') {
         $this->setRedirect("index.php?option=com_jshopping&controller=vendors&task=edit&id=" . $vendor->id);
     } else {
         $this->setRedirect("index.php?option=com_jshopping&controller=vendors");
     }
 }
Esempio n. 26
0
 private function buildAdvQuery()
 {
     if ($this->buildAdvQuery == 1) {
         return 0;
     }
     $jshopConfig = JSFactory::getConfig();
     $dispatcher = JDispatcher::getInstance();
     $db = JFactory::getDBO();
     $product = JSFactory::getTable('product', 'jshop');
     $orderbyq = getQuerySortDirection($this->order, $this->orderby);
     $adv_query = "";
     $adv_from = "";
     $adv_result = $product->getBuildQueryListProductDefaultResult();
     $product->getBuildQueryListProduct("search", "list", $this->filters, $adv_query, $adv_from, $adv_result);
     if ($this->date_to && checkMyDate($this->date_to)) {
         $adv_query .= " AND prod.product_date_added <= '" . $db->escape($this->date_to) . "'";
     }
     if ($this->date_from && checkMyDate($this->date_from)) {
         $adv_query .= " AND prod.product_date_added >= '" . $db->escape($this->date_from) . "'";
     }
     $where_search = "";
     if ($this->search_type == "exact") {
         $word = addcslashes($db->escape($this->search), "_%");
         $tmp = array();
         foreach ($jshopConfig->product_search_fields as $field) {
             $tmp[] = "LOWER(" . getDBFieldNameFromConfig($field) . ") LIKE '%" . $word . "%'";
         }
         $where_search = implode(' OR ', $tmp);
     } else {
         $words = explode(" ", $this->search);
         $search_word = array();
         foreach ($words as $word) {
             $word = addcslashes($db->escape($word), "_%");
             $tmp = array();
             foreach ($jshopConfig->product_search_fields as $field) {
                 $tmp[] = "LOWER(" . getDBFieldNameFromConfig($field) . ") LIKE '%" . $word . "%'";
             }
             $where_search_block = implode(' OR ', $tmp);
             $search_word[] = "(" . $where_search_block . ")";
         }
         if ($this->search_type == "any") {
             $where_search = implode(" OR ", $search_word);
         } else {
             $where_search = implode(" AND ", $search_word);
         }
     }
     if ($where_search) {
         $adv_query .= " AND ({$where_search})";
     }
     $orderbyf = $jshopConfig->sorting_products_field_s_select[$this->order];
     $order_query = $product->getBuildQueryOrderListProduct($orderbyf, $orderbyq, $adv_from);
     $dispatcher->trigger('onBeforeQueryGetProductList', array("search", &$adv_result, &$adv_from, &$adv_query, &$order_query, &$this->filters));
     $this->adv_result = $adv_result;
     $this->adv_from = $adv_from;
     $this->adv_query = $adv_query;
     $this->order_query = $order_query;
     $this->buildAdvQuery == 1;
     return 1;
 }
Esempio n. 27
0
 function getUnits()
 {
     $db = JFactory::getDBO();
     $lang = JSFactory::getLang();
     $query = "SELECT id, `" . $lang->get('name') . "` as name FROM `#__jshopping_unit` ORDER BY name";
     $db->setQuery($query);
     return $db->loadObjectList();
 }
Esempio n. 28
0
 function getProdNameById($id)
 {
     $db = JFactory::getDBO();
     $lang = JSFactory::getLang();
     $query = "select pr.`" . $lang->get('name') . "` as name from #__jshopping_products  as pr where pr.product_id = '{$id}' LIMIT 1";
     $db->setQuery($query);
     return $db->loadResult();
 }
Esempio n. 29
0
 function loadData($alias)
 {
     $lang = JSFactory::getLang();
     $db = JFactory::getDBO();
     $query = "SELECT id, alias, `" . $lang->get('title') . "` as title, `" . $lang->get('keyword') . "` as keyword, `" . $lang->get('description') . "` as description FROM `#__jshopping_config_seo` where alias='" . $db->escape($alias) . "'";
     $db->setQuery($query);
     return $db->loadObject();
 }
Esempio n. 30
0
File: seo.php Progetto: Tommar/vino2
 function getList()
 {
     $lang = JSFactory::getLang();
     $db = JFactory::getDBO();
     $query = "SELECT id, alias, `" . $lang->get('title') . "` as title, `" . $lang->get('keyword') . "` as keyword, `" . $lang->get('description') . "` as description FROM `#__jshopping_config_seo` ORDER BY ordering";
     $db->setQuery($query);
     return $db->loadObjectList();
 }