function listProductUpdateData($products, $setUrl = 0) { $jshopConfig = JSFactory::getConfig(); $userShop = JSFactory::getUserShop(); $taxes = JSFactory::getAllTaxes(); if ($jshopConfig->product_list_show_manufacturer) { $manufacturers = JSFactory::getAllManufacturer(); } if ($jshopConfig->product_list_show_vendor) { $vendors = JSFactory::getAllVendor(); } if ($jshopConfig->show_delivery_time) { $deliverytimes = JSFactory::getAllDeliveryTime(); } $image_path = $jshopConfig->image_product_live_path; $noimage = $jshopConfig->noimage; JPluginHelper::importPlugin('jshoppingproducts'); $dispatcher = JDispatcher::getInstance(); foreach ($products as $key => $value) { $dispatcher->trigger('onListProductUpdateDataProduct', array(&$products, &$key, &$value)); $use_userdiscount = 1; if ($jshopConfig->user_discount_not_apply_prod_old_price && $products[$key]->product_old_price > 0) { $use_userdiscount = 0; } $products[$key]->_original_product_price = $products[$key]->product_price; $products[$key]->product_price_wp = $products[$key]->product_price; $products[$key]->product_price_default = 0; if ($jshopConfig->product_list_show_min_price) { if ($products[$key]->min_price > 0) { $products[$key]->product_price = $products[$key]->min_price; } } $products[$key]->show_price_from = 0; if ($jshopConfig->product_list_show_min_price && $value->different_prices) { $products[$key]->show_price_from = 1; } $products[$key]->product_price = getPriceFromCurrency($products[$key]->product_price, $products[$key]->currency_id); $products[$key]->product_old_price = getPriceFromCurrency($products[$key]->product_old_price, $products[$key]->currency_id); $products[$key]->product_price_wp = getPriceFromCurrency($products[$key]->product_price_wp, $products[$key]->currency_id); $products[$key]->product_price = getPriceCalcParamsTax($products[$key]->product_price, $products[$key]->tax_id); $products[$key]->product_old_price = getPriceCalcParamsTax($products[$key]->product_old_price, $products[$key]->tax_id); $products[$key]->product_price_wp = getPriceCalcParamsTax($products[$key]->product_price_wp, $products[$key]->tax_id); if ($userShop->percent_discount && $use_userdiscount) { $products[$key]->product_price_default = $products[$key]->_original_product_price; $products[$key]->product_price_default = getPriceFromCurrency($products[$key]->product_price_default, $products[$key]->currency_id); $products[$key]->product_price_default = getPriceCalcParamsTax($products[$key]->product_price_default, $products[$key]->tax_id); $products[$key]->product_price = getPriceDiscount($products[$key]->product_price, $userShop->percent_discount); $products[$key]->product_old_price = getPriceDiscount($products[$key]->product_old_price, $userShop->percent_discount); $products[$key]->product_price_wp = getPriceDiscount($products[$key]->product_price_wp, $userShop->percent_discount); } if ($jshopConfig->list_products_calc_basic_price_from_product_price) { $products[$key]->basic_price_info = getProductBasicPriceInfo($value, $products[$key]->product_price_wp); } else { $products[$key]->basic_price_info = getProductBasicPriceInfo($value, $products[$key]->product_price); } if ($value->tax_id) { $products[$key]->tax = $taxes[$value->tax_id]; } if ($jshopConfig->product_list_show_manufacturer && $value->product_manufacturer_id && isset($manufacturers[$value->product_manufacturer_id])) { $products[$key]->manufacturer = $manufacturers[$value->product_manufacturer_id]; } else { $products[$key]->manufacturer = new stdClass(); $products[$key]->manufacturer->name = ''; } if ($jshopConfig->admin_show_product_extra_field) { $products[$key]->extra_field = getProductExtraFieldForProduct($value); } else { $products[$key]->extra_field = ''; } if ($jshopConfig->product_list_show_vendor) { $vendordata = $vendors[$value->vendor_id]; $vendordata->products = SEFLink("index.php?option=com_jshopping&controller=vendor&task=products&vendor_id=" . $vendordata->id, 1); $products[$key]->vendor = $vendordata; } else { $products[$key]->vendor = ''; } if ($jshopConfig->hide_delivery_time_out_of_stock && $products[$key]->product_quantity <= 0) { $products[$key]->delivery_times_id = 0; $value->delivery_times_id = 0; } if ($jshopConfig->show_delivery_time && $value->delivery_times_id) { $products[$key]->delivery_time = $deliverytimes[$value->delivery_times_id]; } else { $products[$key]->delivery_time = ''; } $products[$key]->_display_price = getDisplayPriceForProduct($products[$key]->product_price); if (!$products[$key]->_display_price) { $products[$key]->product_old_price = 0; $products[$key]->product_price_default = 0; $products[$key]->basic_price_info['price_show'] = 0; $products[$key]->tax = 0; $jshopConfig->show_plus_shipping_in_product = 0; } if ($jshopConfig->product_list_show_qty_stock) { $products[$key]->qty_in_stock = getDataProductQtyInStock($products[$key]); } $image = getPatchProductImage($products[$key]->image, 'thumb'); $products[$key]->product_name_image = $products[$key]->image; $products[$key]->product_thumb_image = $image; if (!$image) { $image = $noimage; } $products[$key]->image = $image_path . "/" . $image; $products[$key]->template_block_product = "product.php"; if (!$jshopConfig->admin_show_product_labels) { $products[$key]->label_id = null; } if ($products[$key]->label_id) { $image = getNameImageLabel($products[$key]->label_id); if ($image) { $products[$key]->_label_image = $jshopConfig->image_labels_live_path . "/" . $image; } $products[$key]->_label_name = getNameImageLabel($products[$key]->label_id, 2); } if ($jshopConfig->display_short_descr_multiline) { $products[$key]->short_description = nl2br($products[$key]->short_description); } } if ($setUrl) { addLinkToProducts($products, 0, 1); } $dispatcher->trigger('onListProductUpdateData', array(&$products)); return $products; }
function getSubCategories($parentId, $order = 'id', $ordering = 'asc', $publish = 0) { $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"; } $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`\n WHERE category_parent_id = '" . $this->_db->escape($parentId) . "' " . $add_where . "\n ORDER BY " . $orderby . " " . $ordering; $this->_db->setQuery($query); $categories = $this->_db->loadObjectList(); foreach ($categories as $key => $value) { $categories[$key]->category_link = SEFLink('index.php?option=com_jshopping&controller=category&task=view&category_id=' . $categories[$key]->category_id, 1); } return $categories; }
function getAllManufacturers($publish = 0, $order = "ordering", $dir = "asc") { $lang = JSFactory::getLang(); $db = JFactory::getDBO(); if ($order == "id") { $orderby = "manufacturer_id"; } if ($order == "name") { $orderby = "name"; } if ($order == "ordering") { $orderby = "ordering"; } if (!$orderby) { $orderby = "ordering"; } $query_where = $publish ? "WHERE manufacturer_publish = '1'" : ""; $query = "SELECT manufacturer_id, manufacturer_url, manufacturer_logo, manufacturer_publish, `" . $lang->get('name') . "` as name, `" . $lang->get('description') . "` as description, `" . $lang->get('short_description') . "` as short_description\n\t\t\t\t FROM `#__jshopping_manufacturers` {$query_where} ORDER BY " . $orderby . " " . $dir; $db->setQuery($query); $list = $db->loadObjectList(); foreach ($list as $key => $value) { $list[$key]->link = SEFLink('index.php?option=com_jshopping&controller=manufacturer&task=view&manufacturer_id=' . $list[$key]->manufacturer_id); } extract(js_add_trigger(get_defined_vars(), "after")); return $list; }
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); } }
public function onBeforeAddProductToCart($cart, &$product_id, &$quantity, &$attr_id, &$freeattributes, &$updateqty, &$errors, &$displayErrorMessage, &$additional_fields, &$usetriggers) { $cart->clear(); $date_from = $this->DateToUnix($freeattributes[1]); $date_to = $this->DateToUnix($freeattributes[2]); $db = JFactory::getDBO(); //проверяем не фейковая ли это квартира $field = 'extra_field_' . $this->fake_extra_field_id; $query = "SELECT `{$field}` FROM `#__jshopping_products` WHERE `product_id` = {$product_id}"; $db->setQuery($query); $value = $db->loadResult(); //var_dump($value);die; if ($value == $this->fake_yes_extra_field_value) { $mainframe = JFactory::getApplication(); JError::raiseNotice(100, _JSHOP_OBJECT_IS_BOOKED); $category_id = JRequest::getInt('category_id'); $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=product&task=view&category_id=' . $category_id . '&product_id=' . $product_id, 1, 1)); return; } //проверяем доступность по датам $query = "SELECT `product_id`, `dfrom`, `dto` FROM `#__jshopping_order_bookings` WHERE (`product_id` = {$product_id}) AND (`dfrom` > " . time() . ") ORDER BY `order_id` DESC"; $db->setQuery($query); $rows = $db->loadObjectList(); foreach ($rows as $row) { $order_date_from = $row->dfrom; $order_date_to = $row->dto; if ($date_from >= $order_date_from && $date_from <= $order_date_to || $date_to >= $order_date_from && $date_to <= $order_date_to) { $mainframe = JFactory::getApplication(); JError::raiseNotice(100, _JSHOP_OBJECT_IS_BOOKED); $category_id = JRequest::getInt('category_id'); $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=product&task=view&category_id=' . $category_id . '&product_id=' . $product_id, 1, 1)); break; } } }
/** * отправляется запрос в базу локального сервера для окончательной проверки доступности для бронирования */ public function chekBookingBeforeSave(&$order, &$cart) { $db_local = JDatabase::getInstance(VipLocalApi::getDbConnectOptions()); $db = JFactory::getDBO(); $user = JFactory::getUser(); $adv_user = JSFactory::getUser(); $adv_user = JSFactory::getTable('usershop', 'jshop'); $adv_user->load($user->id); $order->country = $adv_user->country; $order->f_name = $adv_user->f_name; $order->l_name = $adv_user->l_name; $order->email = $adv_user->email; $order->phone = $adv_user->phone; // echo'<pre>';print_r($user);echo'</pre>';//die; // echo'<pre>';print_r($adv_user);echo'</pre>';//die; // echo'<pre>';print_r($order);echo'</pre>';die; $product_id_local = $cart->products[0]['ean']; $product_id = $cart->products[0]['product_id']; $category_id = $cart->products[0]['category_id']; $booking_date_info = $cart->products[0]['free_attributes_value']; //$date_from = '31-10-2015'; $date_from = str_replace('/', '-', $booking_date_info[0]->value); $date_to = str_replace('/', '-', $booking_date_info[1]->value); //проверяем только локальный сервер, так как на WuBook-е установлена нотификация каждого нового бронирования. $object_is_free_on_local = $this->chekBookingOnLocal($db_local, $product_id_local, $date_from, $date_to); //$object_is_free_on_local = true; //повторно проверяем по базе сайта, чтобы никто не забронил номер пока пользователь "копается" $object_is_free_on_site = $this->chekBookingOnSite($db, $product_id, $date_from, $date_to); if ($object_is_free_on_local == true && $object_is_free_on_site == true) { //заменяем разделитеть даты $date_from = str_replace('/', '-', $date_from); $date_to = str_replace('/', '-', $date_to); // echo'<pre>';print_r($product_id_local);echo'</pre>';//die; // echo'<pre>';print_r($date_from);echo'</pre>';//die; // echo'<pre>';print_r($date_to);echo'</pre>';//die; // echo'<pre>';print_r($order);echo'</pre>';die; // echo'<pre>';print_r($db_local);echo'</pre>';die; $k_zajav = VipLocalApi::addBookingOnLocalServer($db_local, $product_id_local, $date_from, $date_to, $order, VipLocalApi::ON_BOOKING_FROM_SITE_PRIM_PREFIX); //echo'<pre>';var_dump($k_zajav);echo'</pre>';die; $session = JFactory::getSession(); $session->set("k_zajav", $k_zajav); } else { $cart->clear(); $mainframe = JFactory::getApplication(); JError::raiseNotice(100, _JSHOP_OBJECT_IS_ALREADY_BOOKED); $contextfilter = "jshoping.list.front.product.cat." . $category_id; $date_from_ = $mainframe->getUserStateFromRequest($contextfilter . 'dfrom', 'dfrom', date('d/m/Y')); $date_to_ = $mainframe->getUserStateFromRequest($contextfilter . 'dto', 'dto', date('d/m/Y', time() + 60 * 60 * 24)); if ($date_from_ == '') { $date_from_ = date('d/m/Y'); } if ($date_to_ == '') { $date_to_ = date('d/m/Y', time() + 60 * 60 * 24); } $mainframe->redirect(SEFLink('index.php?option=com_jshopping&view=category&layout=category&task=view&category_id=' . $category_id . '&dfrom=' . $date_from_ . '&dto=' . $date_to_, 1, 1)); } }
public static function getSearchCategory($selected = null) { $jshopConfig = JSFactory::getConfig(); $attribs = self::getDataultAttribs(''); if ($jshopConfig->admin_show_product_extra_field) { $urlsearchcaracters = SEFLink("index.php?option=com_jshopping&controller=search&task=get_html_characteristics&ajax=1", 0, 1); $attribs .= " onchange='updateSearchCharacteristic(\"" . $urlsearchcaracters . "\",this.value);'"; } return self::getCategory($selected, $attribs); }
public function getUrlCheckout() { $jshopConfig = JSFactory::getConfig(); if ($jshopConfig->shop_user_guest == 1) { $href_checkout = SEFLink('index.php?option=com_jshopping&controller=checkout&task=step2&check_login=1', 1, 0, $jshopConfig->use_ssl); } else { $href_checkout = SEFLink('index.php?option=com_jshopping&controller=checkout&task=step2', 1, 0, $jshopConfig->use_ssl); } return $href_checkout; }
function showEndForm($params, $order) { $db =& JFactory::getDBO(); $hash = md5("authorizenetcc1" . mktime()); $query = "update `#__jshopping_orders` set `order_hash`='" . $db->getEscaped($hash) . "' WHERE `order_id` = '" . $order->order_id . "'"; $db->setQuery($query); $db->query(); $mainframe =& JFactory::getApplication(); $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step7&act=return&js_paymentclass=pm_authorizenet_aim&oid=' . $order->order_id . "&h=" . $hash, 0, 1)); }
function onBeforeDisplayProduct(&$product) { $document = JFactory::getDocument(); $maincategory_id = $product->getCategory(); $product_id = JRequest::getInt('product_id'); $category_id = JRequest::getInt('category_id'); if ($category_id != $maincategory_id) { $url = SEFLink('index.php?option=com_jshopping&controller=product&task=view&category_id=' . $maincategory_id . '&product_id=' . $product_id); $document->addCustomTag('<link rel="canonical" href="' . $url . '"/>'); } }
public function getCheckoutUrl($step, $defaultItemId = 0, $redirect = 1) { $jshopConfig = JSFactory::getConfig(); if (preg_match('/^(\\d)+$/', $step)) { $task = 'step' . $step; } else { $task = $step; } $url = SEFLink('index.php?option=com_jshopping&controller=checkout&task=' . $task, $defaultItemId, $redirect, $jshopConfig->use_ssl); return $url; }
function remove_to_cart() { header("Cache-Control: no-cache, must-revalidate"); $ajax = JRequest::getInt('ajax'); $number_id = JRequest::getInt('number_id'); $cart = JSFactory::getModel('checkout', 'jshop')->removeWishlistItemToCart($number_id); if ($ajax) { print getOkMessageJson($cart); die; } $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1, 1)); }
function showEndForm($pmconfigs, $order) { $jshopConfig = JSFactory::getConfig(); $pm_method = $this->getPmMethod(); $item_name = sprintf(_JSHOP_PAYMENT_NUMBER, $order->order_number); $sandbox = $pmconfigs['testmode'] ? 'sandbox.' : ''; $email = $pmconfigs['email_received']; $token = $pmconfigs[$sandbox ? 'test_token' : 'token']; $address_override = (int) $pmconfigs['address_override']; $_country = JSFactory::getTable('country', 'jshop'); $_country->load($order->d_country); $country = $_country->country_code_2; $order->order_total = $this->fixOrderTotal($order); // Return links $uri = JURI::getInstance(); $liveurlhost = $uri->toString(array('scheme', 'host', 'port')); if ($pmconfigs['notifyurlsef']) { $notify_url = $liveurlhost . SEFLink("index.php?option=com_jshopping&controller=checkout&task=step7&act=notify&js_paymentclass=" . $pm_method->payment_class . "&no_lang=1"); } else { $notify_url = JURI::root() . "index.php?option=com_jshopping&controller=checkout&task=step7&act=notify&js_paymentclass=" . $pm_method->payment_class . "&no_lang=1"; } $return = $liveurlhost . SEFLink("index.php?option=com_jshopping&controller=checkout&task=step7&act=return&js_paymentclass=" . $pm_method->payment_class); $cancel_return = $liveurlhost . SEFLink("index.php?option=com_jshopping&controller=checkout&task=step7&act=cancel&js_paymentclass=" . $pm_method->payment_class); // Build data for the request $vendor = JSFactory::getTable('vendor', 'jshop'); $vendor->loadMain(); $data = array('email' => $email, 'token' => $token, 'senderName' => $vendor->shop_name, 'senderAreaCode' => 11, 'senderEmail' => $order->email, 'currency' => $order->currency_code_iso, 'redirectURL' => $return, 'reference' => $order->order_id, 'itemId1' => $order->order_id, 'itemDescription1' => $item_name, 'itemAmount1' => number_format($order->order_subtotal, 2, '.', ''), 'itemQuantity1' => 1, 'shippingCost' => number_format($order->order_shipping, 2, '.', ''), 'shippingType' => 3, 'shippingAddressStreet' => $order->d_street, 'shippingAddressPostalCode' => $order->d_zip, 'shippingAddressCity' => $order->d_city, 'shippingAddressState' => $order->d_state, 'shippingAddressCountry' => 'BRA'); // Post the order data to PagSeguro $options = array(CURLOPT_POST => 1, CURLOPT_HEADER => 0, CURLOPT_URL => "https://ws.{$sandbox}pagseguro.uol.com.br/v2/checkout/", CURLOPT_FRESH_CONNECT => 1, CURLOPT_RETURNTRANSFER => 1, CURLOPT_FORBID_REUSE => 1, CURLOPT_TIMEOUT => 4, CURLOPT_POSTFIELDS => http_build_query($data)); $ch = curl_init(); curl_setopt_array($ch, $options); if (!($result = curl_exec($ch))) { die('Error: ' . curl_error($ch)); } curl_close($ch); // If we received a code (and it's not an error number), redirect the client to PagSeguro to complete the order $code = preg_match('|<code>(.+?)</code>|', $result, $m) ? $m[1] : false; if ($code && !is_numeric($code)) { header("Location: https://{$sandbox}pagseguro.uol.com.br/v2/checkout/payment.html?code={$code}"); } else { die("Error: {$result}"); } }
function getObjectInfo($id, $language = null) { $info = new JCommentsObjectInfo(); $functions = JPATH_ROOT . '/components/com_jshopping/lib/functions.php'; if (is_file($functions)) { require_once JPATH_ROOT . '/components/com_jshopping/lib/factory.php'; require_once $functions; $titleField = 'name_' . JFactory::getLanguage()->getTag(); $db = JFactory::getDBO(); $query = "SELECT p.`{$titleField}`, p.access, c.category_id " . " FROM #__jshopping_products AS p" . " JOIN #__jshopping_products_to_categories AS c ON p.product_id = c.product_id" . " WHERE p.product_id = " . $id; $db->setQuery($query); $row = $db->loadObject(); if (!empty($row)) { $info->category_id = $row->category_id; $info->title = $row->{$titleField}; $info->access = $row->access; $info->link = SEFLink('index.php?option=com_jshopping&controller=product&task=view&category_id=' . $row->category_id . '&product_id=' . $id); } } return $info; }
function onBeforeRegister(&$post, &$default_usergroup) { $plugin = JComponentHelper::getParams('com_users')->get('captcha', JFactory::getConfig()->get('captcha')); if ($plugin === 0 || $plugin === '0' || $plugin === '' || $plugin === null) { return; } $jshopConfig = JSFactory::getConfig(); $app = JFactory::getApplication(); $language = JFactory::getLanguage(); $language->load('plg_captcha_' . $plugin); $captcha = new JCaptcha($plugin, array()); if (!$captcha->checkAnswer($plugin)) { $error = $captcha->getError(); if ($error instanceof Exception) { JError::raiseWarning('', $error); } else { JError::raiseWarning('', new JException($error)); } $app->redirect(SEFLink("index.php?option=com_jshopping&controller=user&task=register", 1, 1, $jshopConfig->use_ssl)); } }
function products() { $mainframe = JFactory::getApplication(); $jshopConfig = JSFactory::getConfig(); $session = JFactory::getSession(); $session->set("jshop_end_page_buy_product", $_SERVER['REQUEST_URI']); $session->set("jshop_end_page_list_product", $_SERVER['REQUEST_URI']); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeLoadProductList', array()); $vendor_id = JRequest::getInt("vendor_id"); $vendor = JSFactory::getTable('vendor', 'jshop'); $vendor->load($vendor_id); $dispatcher->trigger('onBeforeDisplayVendor', array(&$vendor)); appendPathWay($vendor->shop_name); $seo = JSFactory::getTable("seo", "jshop"); $seodata = $seo->loadData("vendor-product-" . $vendor_id); if (!isset($seodata->title) || $seodata->title == "") { $seodata = new stdClass(); $seodata->title = $vendor->shop_name; $seodata->keyword = $vendor->shop_name; $seodata->description = $vendor->shop_name; } setMetaData($seodata->title, $seodata->keyword, $seodata->description); $action = xhtmlUrl($_SERVER['REQUEST_URI']); $products_page = $jshopConfig->count_products_to_page; $count_product_to_row = $jshopConfig->count_products_to_row; $context = "jshoping.vendor.front.product"; $contextfilter = "jshoping.list.front.product.vendor." . $vendor_id; $orderby = $mainframe->getUserStateFromRequest($context . 'orderby', 'orderby', $jshopConfig->product_sorting_direction, 'int'); $order = $mainframe->getUserStateFromRequest($context . 'order', 'order', $jshopConfig->product_sorting, 'int'); $limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', $products_page, 'int'); if (!$limit) { $limit = $products_page; } $limitstart = JRequest::getInt('limitstart'); if ($order == 4) { $order = 1; } $orderbyq = getQuerySortDirection($order, $orderby); $image_sort_dir = getImgSortDirection($order, $orderby); $field_order = $jshopConfig->sorting_products_field_s_select[$order]; $filters = getBuildFilterListProduct($contextfilter, array("vendors")); $total = $vendor->getCountProducts($filters); jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); $pagenav = $pagination->getPagesLinks(); $dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'vendor')); if ($limitstart >= $total) { $limitstart = 0; } $rows = $vendor->getProducts($filters, $field_order, $orderbyq, $limitstart, $limit); addLinkToProducts($rows, 0, 1); foreach ($jshopConfig->sorting_products_name_s_select as $key => $value) { $sorts[] = JHTML::_('select.option', $key, $value, 'sort_id', 'sort_value'); } insertValueInArray($products_page, $jshopConfig->count_product_select); foreach ($jshopConfig->count_product_select as $key => $value) { $product_count[] = JHTML::_('select.option', $key, $value, 'count_id', 'count_value'); } $sorting_sel = JHTML::_('select.genericlist', $sorts, 'order', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'sort_id', 'sort_value', $order); $product_count_sel = JHTML::_('select.genericlist', $product_count, 'limit', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'count_id', 'count_value', $limit); $_review = JSFactory::getTable('review', 'jshop'); $allow_review = $_review->getAllowReview(); if ($jshopConfig->show_product_list_filters) { $first_el = JHTML::_('select.option', 0, _JSHOP_ALL, 'manufacturer_id', 'name'); $_manufacturers = JSFactory::getTable('manufacturer', 'jshop'); $listmanufacturers = $_manufacturers->getList(); array_unshift($listmanufacturers, $first_el); if (isset($filters['manufacturers'][0])) { $active_manufacturer = $filters['manufacturers'][0]; } else { $active_manufacturer = ''; } $manufacuturers_sel = JHTML::_('select.genericlist', $listmanufacturers, 'manufacturers[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'manufacturer_id', 'name', $active_manufacturer); $first_el = JHTML::_('select.option', 0, _JSHOP_ALL, 'category_id', 'name'); $categories = buildTreeCategory(1); array_unshift($categories, $first_el); if (isset($filters['categorys'][0])) { $active_category = $filters['categorys'][0]; } else { $active_category = 0; } $categorys_sel = JHTML::_('select.genericlist', $categories, 'categorys[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'category_id', 'name', $active_category); } else { $categorys_sel = null; $manufacuturers_sel = null; } $willBeUseFilter = willBeUseFilter($filters); $display_list_products = count($rows) > 0 || $willBeUseFilter; $dispatcher->trigger('onBeforeDisplayProductList', array(&$rows)); $view_name = "vendor"; $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name); $view = $this->getView($view_name, getDocumentType(), '', $view_config); $view->setLayout("products"); $view->assign('config', $jshopConfig); $view->assign('template_block_list_product', "list_products/list_products.php"); $view->assign('template_no_list_product', "list_products/no_products.php"); $view->assign('template_block_form_filter', "list_products/form_filters.php"); $view->assign('template_block_pagination', "list_products/block_pagination.php"); $view->assign('path_image_sorting_dir', $jshopConfig->live_path . 'images/' . $image_sort_dir); $view->assign('filter_show', 1); $view->assign('filter_show_category', 1); $view->assign('filter_show_manufacturer', 1); $view->assign('pagination', $pagenav); $view->assign('pagination_obj', $pagination); $view->assign('display_pagination', $pagenav != ""); $view->assign("rows", $rows); $view->assign("count_product_to_row", $count_product_to_row); $view->assign("vendor", $vendor); $view->assign('action', $action); $view->assign('allow_review', $allow_review); $view->assign('orderby', $orderby); $view->assign('product_count', $product_count_sel); $view->assign('sorting', $sorting_sel); $view->assign('categorys_sel', $categorys_sel); $view->assign('manufacuturers_sel', $manufacuturers_sel); $view->assign('filters', $filters); $view->assign('willBeUseFilter', $willBeUseFilter); $view->assign('display_list_products', $display_list_products); $view->assign('shippinginfo', SEFLink($jshopConfig->shippinginfourl, 1)); $dispatcher->trigger('onBeforeDisplayProductListView', array(&$view)); $view->display(); }
<?php /** * @version 4.1.0 14.08.2013 * @author MAXXmarketing GmbH * @package Jshopping * @copyright Copyright (C) 2010 webdesigner-profi.de. All rights reserved. * @license GNU/GPL */ defined('_JEXEC') or die('Restricted access'); error_reporting(error_reporting() & ~E_NOTICE); if (!file_exists(JPATH_SITE . '/components/com_jshopping/jshopping.php')) { JError::raiseError(500, "Please install component \"joomshopping\""); } require_once JPATH_SITE . '/components/com_jshopping/lib/factory.php'; require_once JPATH_SITE . '/components/com_jshopping/lib/functions.php'; JSFactory::loadCssFiles(); JSFactory::loadJsFiles(); JSFactory::loadLanguageFile(); $adv_search = $params->get('advanced_search'); $category_id = intval($params->get('category_id')); $search_type = $params->get('search_type', 'any'); if ($adv_search) { $adv_search_link = SEFLink('index.php?option=com_jshopping&controller=search', 1); } $search = JRequest::getVar('search', ''); require JModuleHelper::getLayoutPath('mod_jshopping_search');
<?php } ?> </table> </div> <?php if ($config_fields['privacy_statement']['display']) { ?> <div class="jshop_register"> <div class="jshop_block_privacy_statement"> <table> <tr> <td class="name"> <a class="privacy_statement" href="#" onclick="window.open('<?php print SEFLink('index.php?option=com_jshopping&controller=content&task=view&page=privacy_statement&tmpl=component', 1); ?> ','window','width=800, height=600, scrollbars=yes, status=no, toolbar=no, menubar=no, resizable=yes, location=no');return false;"> <?php print _JSHOP_PRIVACY_STATEMENT; ?> <?php if ($config_fields['privacy_statement']['require']) { ?> <span>*</span><?php } ?> </a> </td> <td> <input type="checkbox" name="privacy_statement" id="privacy_statement" value="1" />
public function onLoadStep5save(&$checkagb) { $mainframe = JFactory::getApplication(); $cart = JSFactory::getModel('cart', 'jshop'); $cart->load(); $user = JFactory::getUser(); $adv_user = JSFactory::getUser(); //echo'<pre>$user ';print_r($user);echo'</pre>';//die; //echo'<pre>$adv_user ';print_r($adv_user);echo'</pre>';die; $payment_method = JRequest::getVar('payment_method', ''); //class payment method if ($payment_method == '') { $session = JFactory::getSession(); $payment_method = $session->get("payment_method", ''); } //echo'<pre>';var_dump($payment_method);echo'</pre>';//die; $params = JRequest::getVar('params', array()); if (isset($params[$payment_method])) { $params_pm = $params[$payment_method]; } else { $params_pm = ''; } $paym_method = JSFactory::getTable('paymentmethod', 'jshop'); $paym_method->class = $payment_method; $payment_method_id = $paym_method->getId(); $paym_method->load($payment_method_id); //echo'<pre>';print_r($paym_method);echo'</pre>';die; $pmconfigs = $paym_method->getConfigs(); $paymentsysdata = $paym_method->getPaymentSystemData(); $payment_system = $paymentsysdata->paymentSystem; //echo'<pre>';print_r($paymentsysdata->paymentSystemError);echo'</pre>';//die; //echo'<pre>';print_r($paym_method->payment_publish);echo'</pre>';//die; if ($paymentsysdata->paymentSystemError || $paym_method->payment_publish == 0) { //echo'<pre>';print_r('_JSHOP_ERROR_PAYMENT');echo'</pre>';die; $cart->setPaymentParams(''); JError::raiseWarning(500, _JSHOP_ERROR_PAYMENT); $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step3', 0, 1, $jshopConfig->use_ssl)); return 0; } if ($payment_system) { if (!$payment_system->checkPaymentInfo($params_pm, $pmconfigs)) { $cart->setPaymentParams(''); JError::raiseWarning("", $payment_system->getErrorMessage()); $mainframe->redirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step3', 0, 1, $jshopConfig->use_ssl)); return 0; } } $paym_method->setCart($cart); $cart->setPaymentId($payment_method_id); $price = $paym_method->getPrice(); $cart->setPaymentDatas($price, $paym_method); if (isset($params[$payment_method])) { $cart->setPaymentParams($params_pm); } else { $cart->setPaymentParams(''); } //echo'<pre>$adv_user ';var_dump($payment_method_id);echo'</pre>';die; $db = JFactory::getDbo(); $query = "UPDATE `#__jshopping_users` SET payment_id = {$payment_method_id} WHERE user_id = " . $user->id; $db->setQuery($query); $result = $db->execute(); }
<?php print $this->_tmp_html_after_buttons; ?> </form> <?php print $this->_tmp_ext_html_before_discount; ?> <?php if ($this->use_rabatt && $countprod > 0) { ?> <div class="cart_block_discount"> <form name="rabatt" class="form-inline" method="post" action="<?php print SEFLink('index.php?option=com_jshopping&controller=cart&task=discountsave'); ?> "> <div class = "row-fluid jshop"> <div class = "span12"> <div class="name"><?php print _JSHOP_RABATT; ?> </div> <input type = "text" class = "inputbox" name = "rabatt" value = "" /> <input type = "submit" class = "btn btn-primary button" value = "<?php print _JSHOP_RABATT_ACTIVE; ?> " /> </div> </div>
print JText::_('LOST_PASSWORD'); ?> </a> </div> <?php /*<div> <a href="<?php echo JRoute::_( 'index.php?option=com_user&view=remind' ); ?>"><?php echo JText::_('FORGOT_YOUR_USERNAME'); ?></a> </div> */ ?> <?php $usersConfig = JComponentHelper::getParams('com_users'); if ($usersConfig->get('allowUserRegistration')) { ?> <div> <a href="<?php echo SEFLink('index.php?option=com_jshopping&controller=user&task=register', 1); ?> "><?php print JText::_('REGISTRATION'); ?> </a> </div> <?php } ?> <?php echo $params->get('posttext'); ?> <input type="hidden" name="option" value="com_jshopping" /> <input type="hidden" name="controller" value="user" />
function discountsave() { $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onLoadDiscountSave', array()); $ajax = JRequest::getInt('ajax'); $coupon = JSFactory::getTable('coupon', 'jshop'); $code = JRequest::getVar('rabatt'); if ($coupon->getEnableCode($code)) { $cart = JSFactory::getModel('cart', 'jshop'); $cart->load(); $dispatcher->trigger('onBeforeDiscountSave', array(&$coupon, &$cart)); $cart->setRabatt($coupon->coupon_id, $coupon->coupon_type, $coupon->coupon_value); $dispatcher->trigger('onAfterDiscountSave', array(&$coupon, &$cart)); if ($ajax) { print getOkMessageJson($cart); die; } } else { JError::raiseWarning('', $coupon->error); if ($ajax) { print getMessageJson(); die; } } $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 0, 1)); }
<?php foreach ($this->demofiles as $demo) { ?> <tr> <td class="descr"><?php print $demo->demo_descr; ?> </td> <?php if ($this->config->demo_type == 1) { ?> <td class="download"><a target="_blank" href="<?php print $this->config->demo_product_live_path . "/" . $demo->demo; ?> " onClick="popupWin = window.open('<?php print SEFLink("index.php?option=com_jshopping&controller=product&task=showmedia&media_id=" . $demo->id); ?> ', 'video', 'width=<?php print $this->config->video_product_width; ?> ,height=<?php print $this->config->video_product_height; ?> ,top=0,resizable=no,location=no'); popupWin.focus(); return false;"><img src = "<?php print $this->config->live_path . 'images/play.gif'; ?> " alt = "play" title = "play"/></a></td> <?php } else { ?> <td class="download"><a target="_blank" href="<?php
public function getList() { /** * Get data */ $db = JFactory::getDBO(); $data = array(); //select from $source = trim($this->_params->get('source', 'js_categories')); if ($source == 'js_categories') { $catids = $this->_params->get('js_categories', ''); } else { if ($this->_params->get('js_ids', '')) { $ids = preg_split('/,/', $this->_params->get('js_ids', '')); $ids_tmp = array(); foreach ($ids as $id) { $ids_tmp[] = (int) trim($id); } } } if ($source == 'js_categories' && $catids && $this->_params->get('limit_items_for_each')) { foreach ($catids as $catid) { $query = $this->buildQuery($catid); $db->setQuery($query); $data = array_merge($data, $db->loadObjectlist()); } } else { if ($source == 'js_categories' && $catids) { $query = $this->buildQuery($catids); $db->setQuery($query); $data = array_merge($data, $db->loadObjectlist()); } else { if ($source == 'js_ids' && $ids_tmp && count($ids_tmp)) { $query = $this->buildQuery(false, $ids_tmp); $db->setQuery($query); $data = array_merge($data, $db->loadObjectlist()); } else { $query = $this->buildQuery(false, false); $db->setQuery($query); $data = array_merge($data, $db->loadObjectlist()); } } } //add link if (!class_exists('JSFactory')) { return null; } $jshopConfig = JSFactory::getConfig(); $userShop = JSFactory::getUserShop(); foreach ($data as $product) { $product->link = SEFLink('index.php?option=com_jshopping&controller=product&task=view&category_id=' . $product->category_id . '&product_id=' . $product->id, 1); if ($jshopConfig->show_buy_in_category) { if (!($jshopConfig->hide_buy_not_avaible_stock && $product->product_quantity <= 0)) { $product->add_to_cart = '<a class="bt-addtocart" href="' . SEFLink('index.php?option=com_jshopping&controller=cart&task=add&category_id=' . $product->category_id . '&product_id=' . $product->id, 1) . '" title="' . sprintf(JText::_('ADD_PRODUCT_TO_CART'), $product->name) . '">' . JText::_('ADD_TO_CART') . '</a>'; } } if ($jshopConfig->image_product_live_path) { $product->thumbnail = $jshopConfig->image_product_live_path . '/' . $product->thumbnail; } $product->category_link = SEFLink('index.php?option=com_jshopping&controller=category&task=view&category_id=' . $product->category_id, 1); //calculate price $product->product_price = getPriceFromCurrency($product->product_price, $product->currency_id); $product->product_old_price = getPriceFromCurrency($product->product_old_price, $product->currency_id); $product->product_price = getPriceCalcParamsTax($product->product_price, $product->product_tax_id); $product->product_old_price = getPriceCalcParamsTax($product->product_old_price, $product->product_tax_id); if ($userShop->percent_discount) { $product->product_price = getPriceDiscount($product->product_price, $userShop->percent_discount); $product->product_old_price = getPriceDiscount($product->product_old_price, $userShop->percent_discount); } $product->old_price = ''; if ($product->product_old_price) { $product->old_price = formatprice($product->product_old_price); } if ($product->product_price) { $product->sales_price = formatprice($product->product_price); } // title cut $titleMaxChars = $this->_params->get('title_max_chars', '100'); $limit_title_by = $this->_params->get('limit_title_by', 'char'); $replacer = $this->_params->get('replacer', '...'); $isStrips = $this->_params->get("auto_strip_tags", 1); $stringtags = ''; if ($limit_title_by == 'word' && $titleMaxChars > 0) { $product->name_cut = self::substrword($product->name, $titleMaxChars, $replacer, $isStrips); } elseif ($limit_title_by == 'char' && $titleMaxChars > 0) { $product->name_cut = self::substring($product->name, $titleMaxChars, $replacer, $isStrips); } } if (empty($data)) { return array(); } /** * Get display and config params */ /* title */ $isStrips = $this->_params->get("auto_strip_tags", 1); $stringtags = ''; if ($isStrips) { $allow_tags = $this->_params->get("allow_tags", ''); $stringtags = ''; if (!is_array($allow_tags)) { $allow_tags = explode(',', $allow_tags); } foreach ($allow_tags as $tag) { $stringtags .= '<' . $tag . '>'; } } if (!$this->_params->get('default_thumb', 1)) { $this->_defaultThumb = ''; } /* intro */ $maxDesciption = $this->_params->get('description_max_chars', 100); $limitDescriptionBy = $this->_params->get('limit_description_by', 'char'); $isThumb = $this->_params->get('image_thumb', 1); $dateFormat = $this->_params->get('date_format', 'DATE_FORMAT_LC3'); foreach ($data as $key => &$product) { if ($this->_params->get('show_date')) { $product->date = JHtml::_('date', $product->created_on, JText::_($dateFormat)); } if ($this->_params->get('show_intro')) { if ($limitDescriptionBy == 'word') { $product->description = self::substrword($product->introtext, $maxDesciption, $stringtags); } else { $product->description = self::substring($product->introtext, $maxDesciption, $stringtags); } } //if show image if ($this->_params->get('show_image')) { $product->thumbnail = explode(',', $product->thumbnail); $thumbnail = ''; foreach ($product->thumbnail as $tmpThumbnail) { $type = explode('.', $tmpThumbnail); $type = strtolower($type[count($type) - 1]); if (in_array($type, array('jpg', 'jpeg', 'png', 'png'))) { $thumbnail = $tmpThumbnail; break; } } $product->thumbnail = $thumbnail; $product = $this->generateImages($product, $isThumb); } //get label $product->label_image = $product->label_image ? $jshopConfig->image_labels_live_path . "/" . $product->label_image : ''; if ($this->_params->get('show_manufacturer')) { $product->manufacturer_link = SEFLink('index.php?option=com_jshopping&controller=manufacturer&task=view&manufacturer_id=' . $product->product_manufacturer_id); } } if ($this->_params->get('show_rating')) { foreach ($data as $key => &$product) { $count = floor($jshopConfig->max_mark / $jshopConfig->rating_starparts); $width = $count * 16; $rating = round($product->rating); $product->ratingSpan = '<span class="vote">'; if (empty($rating)) { $product->ratingSpan .= '<span style="width: ' . $width . 'px;" title="' . JText::_("RATING_UNRATE") . '" class="ratingbox" style="display:inline-block;">'; } else { $width_active = intval($rating * 16 / $jshopConfig->rating_starparts); $product->ratingSpan .= '<span style="width: ' . $width . 'px;" title="' . JText::_("RATING") . ' ' . $rating . '/' . $jshopConfig->max_mark . '" class="ratingbox" style="display:inline-block;">'; $product->ratingSpan .= '<span class="ratingactive" style="width: ' . $width_active . 'px"></span>'; } $product->ratingSpan .= '</span></span>'; } } return $data; }
} ?> <table width="100%"> <tr> <td width="50%" valign="top" class="login_block"> <span class="small_header"><?php print _JSHOP_HAVE_ACCOUNT; ?> </span> <span><?php print _JSHOP_PL_LOGIN; ?> </span> <form method = "post" action="<?php print SEFLink('index.php?option=com_jshopping&controller=user&task=loginsave', 1, 0, $this->config->use_ssl); ?> " name = "jlogin"> <table style="margin-top:3px;"> <tr> <td><?php print _JSHOP_USERNAME; ?> : </td> <td><input type = "text" name = "username" value = "" class = "inputbox" placeholder="Tài khoản"/></td> </tr> <tr> <td><?php print _JSHOP_PASSWORT; ?> : </td>
function remove_to_cart() { header("Cache-Control: no-cache, must-revalidate"); $ajax = JRequest::getInt('ajax'); $number_id = JRequest::getInt('number_id'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeLoadWishlistRemoveToCart', array(&$number_id)); $cart = JSFactory::getModel('cart', 'jshop'); $cart->load("wishlist"); $prod = $cart->products[$number_id]; $attr = unserialize($prod['attributes']); $freeattribut = unserialize($prod['freeattributes']); $cart->delete($number_id); $cart = JSFactory::getModel('cart', 'jshop'); $cart->load("cart"); $cart->add($prod['product_id'], $prod['quantity'], $attr, $freeattribut); $dispatcher->trigger('onAfterWishlistRemoveToCart', array(&$cart)); if ($ajax) { print getOkMessageJson($cart); die; } $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=cart&task=view', 1, 1)); }
?> <div class="row_agb"> <input type = "checkbox" name = "agb" id = "agb" /> <a class = "policy" href="#" onclick="window.open('<?php print SEFLink('index.php?option=com_jshopping&controller=content&task=view&page=agb&tmpl=component', 1); ?> ','window','width=800, height=600, scrollbars=yes, status=no, toolbar=no, menubar=no, resizable=yes, location=no');return false;"><?php print _JSHOP_AGB; ?> </a> <?php print _JSHOP_AND; ?> <a class = "policy" href="#" onclick="window.open('<?php print SEFLink('index.php?option=com_jshopping&controller=content&task=view&page=return_policy&tmpl=component', 1); ?> ','window','width=800, height=600, scrollbars=yes, status=no, toolbar=no, menubar=no, resizable=yes, location=no');return false;"><?php print _JSHOP_RETURN_POLICY; ?> </a> <?php print _JSHOP_CONFIRM; ?> </div> <?php } ?> <div class="previewfinsh_address">
function _cancelPayOrder($order_id = "") { $jshopConfig = JSFactory::getConfig(); $checkout = JModelLegacy::getInstance('checkout', 'jshop'); $wmiframe = JRequest::getInt("wmiframe"); $session = JFactory::getSession(); if (!$order_id) { $order_id = $session->get('jshop_end_order_id'); } if (!$order_id) { JError::raiseWarning("", _JSHOP_SESSION_FINISH); if (!$wmiframe) { $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5', 0, 1, $jshopConfig->use_ssl)); } else { $this->iframeRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5', 0, 1, $jshopConfig->use_ssl)); } return 0; } $checkout->cancelPayOrder($order_id); JError::raiseWarning("", _JSHOP_PAYMENT_CANCELED); if (!$wmiframe) { $this->setRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5', 0, 1, $jshopConfig->use_ssl)); } else { $this->iframeRedirect(SEFLink('index.php?option=com_jshopping&controller=checkout&task=step5', 0, 1, $jshopConfig->use_ssl)); } return 0; }
function myaccount() { $jshopConfig = JSFactory::getConfig(); checkUserLogin(); $user = JFactory::getUser(); $adv_user = JSFactory::getUserShop(); $lang = JSFactory::getLang(); $country = JTable::getInstance('country', 'jshop'); $country->load($adv_user->country); $field_country_name = $lang->get("name"); $adv_user->country = $country->{$field_country_name}; $group = JTable::getInstance('userGroup', 'jshop'); $group->load($adv_user->usergroup_id); $adv_user->groupname = $group->usergroup_name; $adv_user->discountpercent = floatval($group->usergroup_discount); $seo = JTable::getInstance("seo", "jshop"); $seodata = $seo->loadData("myaccount"); if ($seodata->title == "") { $seodata->title = _JSHOP_MY_ACCOUNT; } setMetaData($seodata->title, $seodata->keyword, $seodata->description); $tmp_fields = $jshopConfig->getListFieldsRegister(); $config_fields = $tmp_fields['editaccount']; JPluginHelper::importPlugin('jshoppingcheckout'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeDisplayMyAccount', array()); $view_name = "user"; $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name); $view = $this->getView($view_name, getDocumentType(), '', $view_config); $view->setLayout("myaccount"); $view->assign('config', $jshopConfig); $view->assign('user', $adv_user); $view->assign('config_fields', $config_fields); $view->assign('href_user_group_info', SEFLink('index.php?option=com_jshopping&controller=user&task=groupsinfo')); $view->assign('href_edit_data', SEFLink('index.php?option=com_jshopping&controller=user&task=editaccount', 0, 0, $jshopConfig->use_ssl)); $view->assign('href_show_orders', SEFLink('index.php?option=com_jshopping&controller=user&task=orders', 0, 0, $jshopConfig->use_ssl)); $view->assign('href_logout', SEFLink('index.php?option=com_jshopping&controller=user&task=logout')); $dispatcher->trigger('onBeforeDisplayMyAccountView', array(&$view)); $view->display(); }
<?php defined('_JEXEC') or die; ?> <div class="jshop"> <h1><?php print _JSHOP_LOGOUT; ?> </h1> <input type="button" value="<?php print _JSHOP_LOGOUT; ?> " onclick="location.href='<?php print SEFLink("index.php?option=com_jshopping&controller=user&task=logout"); ?> '" /> </div>