本文整理汇总了PHP中JSFactory::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP JSFactory::getTable方法的具体用法?PHP JSFactory::getTable怎么用?PHP JSFactory::getTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSFactory
的用法示例。
在下文中一共展示了JSFactory::getTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
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");
}
}
示例2: getDisplayPriceFront
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;
}
示例3: getListOrders
public function getListOrders()
{
$order = JSFactory::getTable('order', 'jshop');
$this->list = $order->getOrdersForUser($this->user_id);
$this->loadOrderLink();
return $this->list;
}
示例4: save
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");
}
}
示例5: getFreightPrice
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;
}
示例6: getAllPaymentMethods
function getAllPaymentMethods($publish = 1, $shipping_id = 0)
{
$db = JFactory::getDBO();
$jshopConfig = JSFactory::getConfig();
$query_where = $publish ? "WHERE payment_publish = '1'" : "";
$lang = JSFactory::getLang();
$query = "SELECT payment_id, `" . $lang->get("name") . "` as name, `" . $lang->get("description") . "` as description , payment_code, payment_class, scriptname, payment_publish, payment_ordering, payment_params, payment_type, price, price_type, tax_id, image FROM `#__jshopping_payment_method` {$query_where} ORDER BY payment_ordering";
extract(js_add_trigger(get_defined_vars(), "query"));
$db->setQuery($query);
$rows = $db->loadObjectList();
if ($shipping_id && $jshopConfig->step_4_3) {
$sh = JSFactory::getTable('shippingMethod', 'jshop');
$sh->load($shipping_id);
$payments = $sh->getPayments();
if (count($payments) > 0) {
foreach ($rows as $k => $v) {
if (!in_array($v->payment_id, $payments)) {
unset($rows[$k]);
}
}
$rows = array_values($rows);
}
}
return $rows;
}
示例7: updateUserGroup
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();
}
}
}
示例8: display
function display($cachable = false, $urlparams = false)
{
$jshopConfig = JSFactory::getConfig();
$dispatcher = JDispatcher::getInstance();
JSFactory::getModel('productShop', 'jshop')->storeEndPages();
$product = JSFactory::getTable('product', 'jshop');
$params = JFactory::getApplication()->getParams();
$header = getPageHeaderOfParams($params);
$prefix = $params->get('pageclass_sfx');
JshopHelpersMetadata::allProducts();
$productlist = JSFactory::getModel('productList', 'jshop');
$productlist->setModel($product);
$productlist->load();
$orderby = $productlist->getOrderBy();
$image_sort_dir = $productlist->getImageSortDir();
$filters = $productlist->getFilters();
$action = $productlist->getAction();
$products = $productlist->getProducts();
$pagination = $productlist->getPagination();
$pagenav = $productlist->getPagenav();
$sorting_sel = $productlist->getHtmlSelectSorting();
$product_count_sel = $productlist->getHtmlSelectCount();
$willBeUseFilter = $productlist->getWillBeUseFilter();
$display_list_products = $productlist->getDisplayListProducts();
$manufacuturers_sel = $productlist->getHtmlSelectFilterManufacturer(1);
$categorys_sel = $productlist->getHtmlSelectFilterCategory(1);
$allow_review = $productlist->getAllowReview();
$view = $this->getView('products');
$view->setLayout("products");
$view->assign('config', $jshopConfig);
$view->assign('template_block_list_product', $productlist->getTmplBlockListProduct());
$view->assign('template_no_list_product', $productlist->getTmplNoListProduct());
$view->assign('template_block_form_filter', $productlist->getTmplBlockFormFilter());
$view->assign('template_block_pagination', $productlist->getTmplBlockPagination());
$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("header", $header);
$view->assign("prefix", $prefix);
$view->assign("rows", $products);
$view->assign("count_product_to_row", $productlist->getCountProductsToRow());
$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();
}
示例9: buildAdvQuery
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;
}
示例10: chekBookingBeforeSave
/**
* отправляется запрос в базу локального сервера для окончательной проверки доступности для бронирования
*/
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));
}
}
示例11: getAddonId
public function getAddonId()
{
if (!$this->addon_id) {
$addon = JSFactory::getTable('addon', 'jshop');
$addon->loadAlias($this->addon_alias);
$this->addon_id = $addon->id;
}
return $this->addon_id;
}
示例12: getDescriptionMainPage
function getDescriptionMainPage($preparePluginContent = 1)
{
$statictext = JSFactory::getTable("statictext", "jshop");
$rowstatictext = $statictext->loadData("manufacturer");
$this->description = $rowstatictext->text;
if ($preparePluginContent && JSFactory::getConfig()->use_plugin_content) {
changeDataUsePluginContent($this, "manufacturer");
}
return $this->description;
}
示例13: delete
function delete($id, $check = 1)
{
if ($check) {
if ($this->getCountProduct($id)) {
return 0;
}
}
$row = JSFactory::getTable('currency', 'jshop');
return $row->delete($id);
}
示例14: save
public function save()
{
$this->review->store();
$product_id = $this->getProductId();
JDispatcher::getInstance()->trigger('onAfterSaveReview', array(&$this->review));
$product = JSFactory::getTable('product', 'jshop');
$product->load($product_id);
$product->loadAverageRating();
$product->loadReviewsCount();
$product->store();
}
示例15: getManufacturer
public static function getManufacturer($selected = null, $attribs = null, $name = 'manufacturer_id')
{
$first = JHTML::_('select.option', 0, _JSHOP_SEARCH_ALL_MANUFACTURERS, 'manufacturer_id', 'name');
$_manufacturers = JSFactory::getTable('manufacturer', 'jshop');
$options = $_manufacturers->getList();
array_unshift($options, $first);
if (is_null($attribs)) {
$attribs = self::getDataultAttribs('');
}
return JHTML::_('select.genericlist', $options, $name, $attribs, 'manufacturer_id', 'name', $selected);
}