当前位置: 首页>>代码示例>>PHP>>正文


PHP saveAsPrice函数代码示例

本文整理汇总了PHP中saveAsPrice函数的典型用法代码示例。如果您正苦于以下问题:PHP saveAsPrice函数的具体用法?PHP saveAsPrice怎么用?PHP saveAsPrice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了saveAsPrice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 function save()
 {
     $tax_id = JRequest::getInt("tax_id");
     $tax = JSFactory::getTable('tax', 'jshop');
     $post = JRequest::get("post");
     $post['tax_value'] = saveAsPrice($post['tax_value']);
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeSaveTax', array(&$tax));
     if (!$tax->bind($post)) {
         JError::raiseWarning("", _JSHOP_ERROR_BIND);
         $this->setRedirect("index.php?option=com_jshopping&controller=taxes");
         return 0;
     }
     if (!$tax->store()) {
         JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
         $this->setRedirect("index.php?option=com_jshopping&controller=taxes");
         return 0;
     }
     $dispatcher->trigger('onAfterSaveTax', array(&$tax));
     if ($this->getTask() == 'apply') {
         $this->setRedirect("index.php?option=com_jshopping&controller=taxes&task=edit&tax_id=" . $tax->tax_id);
     } else {
         $this->setRedirect("index.php?option=com_jshopping&controller=taxes");
     }
 }
开发者ID:arkane0906,项目名称:lasercut-bootstrap,代码行数:25,代码来源:taxes.php

示例2: save

 function save()
 {
     $dispatcher = JDispatcher::getInstance();
     $currency_id = JRequest::getInt("currency_id");
     $apply = JRequest::getVar("apply");
     $currency = JSFactory::getTable('currency', 'jshop');
     $post = JRequest::get("post");
     $post['currency_value'] = saveAsPrice($post['currency_value']);
     $dispatcher->trigger('onBeforeSaveCurrencie', array(&$post));
     if (!$currency->bind($post)) {
         JError::raiseWarning("", _JSHOP_ERROR_BIND);
         $this->setRedirect("index.php?option=com_jshopping&controller=currencies");
         return 0;
     }
     if ($currency->currency_value == 0) {
         $currency->currency_value = 1;
     }
     $this->_reorderCurrency($currency);
     if (!$currency->store()) {
         JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
         $this->setRedirect("index.php?option=com_jshopping&controller=currencies");
         return 0;
     }
     $dispatcher->trigger('onAfterSaveCurrencie', array(&$currency));
     if ($this->getTask() == 'apply') {
         $this->setRedirect("index.php?option=com_jshopping&controller=currencies&task=edit&currency_id=" . $currency->currency_id);
     } else {
         $this->setRedirect("index.php?option=com_jshopping&controller=currencies");
     }
 }
开发者ID:JexyRu,项目名称:jshop-updates,代码行数:30,代码来源:currencies.php

示例3: getPriceFrom

 public function getPriceFrom()
 {
     if (isset($this->request['price_from'])) {
         $price_from = saveAsPrice($this->request['price_from']);
     } else {
         $price_from = null;
     }
     return $price_from;
 }
开发者ID:panickylemon,项目名称:joomlastayn,代码行数:9,代码来源:searchrequest.php

示例4: savegroup

 function savegroup()
 {
     $jshopConfig = JSFactory::getConfig();
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforSaveListProduct', array());
     $cid = JRequest::getVar('cid');
     $post = JRequest::get('post');
     $_products = $this->getModel("products");
     foreach ($cid as $id) {
         $product = JTable::getInstance('product', 'jshop');
         $product->load($id);
         if ($post['access'] != -1) {
             $product->set('access', $post['access']);
         }
         if ($post['product_publish'] != -1) {
             $product->set('product_publish', $post['product_publish']);
         }
         if ($post['product_weight'] != "") {
             $product->set('product_weight', $post['product_weight']);
         }
         if ($post['product_quantity'] != "") {
             $product->set('product_quantity', $post['product_quantity']);
             $product->set('unlimited', 0);
         }
         if (isset($post['unlimited']) && $post['unlimited']) {
             $product->set('product_quantity', 1);
             $product->set('unlimited', 1);
         }
         if (isset($post['product_template']) && $post['product_template'] != -1) {
             $product->set('product_template', $post['product_template']);
         }
         if (isset($post['product_tax_id']) && $post['product_tax_id'] != -1) {
             $product->set('product_tax_id', $post['product_tax_id']);
         }
         if (isset($post['product_manufacturer_id']) && $post['product_manufacturer_id'] != -1) {
             $product->set('product_manufacturer_id', $post['product_manufacturer_id']);
         }
         if (isset($post['vendor_id']) && $post['vendor_id'] != -1) {
             $product->set('vendor_id', $post['vendor_id']);
         }
         if (isset($post['delivery_times_id']) && $post['delivery_times_id'] != -1) {
             $product->set('delivery_times_id', $post['delivery_times_id']);
         }
         if (isset($post['label_id']) && $post['label_id'] != -1) {
             $product->set('label_id', $post['label_id']);
         }
         if (isset($post['weight_volume_units']) && $post['weight_volume_units'] != "") {
             $product->set('weight_volume_units', $post['weight_volume_units']);
             $product->set('basic_price_unit_id', $post['basic_price_unit_id']);
         }
         if ($post['product_price'] != "") {
             $oldprice = $product->product_price;
             $price = $_products->getModPrice($product->product_price, saveAsPrice($post['product_price']), $post['mod_price']);
             $product->set('product_price', $price);
             if ($post['use_old_val_price'] == 1) {
                 $product->set('product_old_price', $oldprice);
             }
         }
         if (isset($post['product_old_price']) && $post['product_old_price'] != "") {
             $price = $_products->getModPrice($product->product_old_price, saveAsPrice($post['product_old_price']), $post['mod_old_price']);
             $product->set('product_old_price', $price);
         }
         if (isset($post['product_price']) && $post['product_price'] != "" || $post['product_old_price'] != "") {
             $product->set('currency_id', $post['currency_id']);
         }
         if (isset($post['category_id']) && $post['category_id']) {
             $_products->setCategoryToProduct($id, $post['category_id']);
         }
         $_products->updatePriceAndQtyDependAttr($id, $post);
         $product->store();
         if ($post['product_price'] != "") {
             $mprice = $product->getMinimumPrice();
             $product->set('min_price', $mprice);
         }
         if (!$product->unlimited) {
             $qty = $product->getFullQty();
             $product->set('product_quantity', $qty);
         }
         $product->date_modify = getJsDate();
         $product->store();
         unset($product);
     }
     $dispatcher->trigger('onAfterSaveListProductEnd', array($cid, $post));
     $this->setRedirect("index.php?option=com_jshopping&controller=products", _JSHOP_PRODUCT_SAVED);
 }
开发者ID:ngogiangthanh,项目名称:damtvnewversion,代码行数:86,代码来源:products.php

示例5: savegroup

 function savegroup()
 {
     $jshopConfig = JSFactory::getConfig();
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforSaveListProduct', array());
     $cid = JRequest::getVar('cid');
     $post = JRequest::get('post');
     $_products = JSFactory::getModel("products");
     foreach ($cid as $id) {
         $product = JSFactory::getTable('product', 'jshop');
         $product->load($id);
         if ($post['access'] != -1) {
             $product->set('access', $post['access']);
         }
         if ($post['product_publish'] != -1) {
             $product->set('product_publish', $post['product_publish']);
         }
         if ($post['product_weight'] != "") {
             $product->set('product_weight', $post['product_weight']);
         }
         if ($post['product_quantity'] != "") {
             $product->set('product_quantity', $post['product_quantity']);
             $product->set('unlimited', 0);
         }
         if (isset($post['unlimited']) && $post['unlimited']) {
             $product->set('product_quantity', 1);
             $product->set('unlimited', 1);
         }
         if (isset($post['product_template']) && $post['product_template'] != -1) {
             $product->set('product_template', $post['product_template']);
         }
         if (isset($post['product_tax_id']) && $post['product_tax_id'] != -1) {
             $product->set('product_tax_id', $post['product_tax_id']);
         }
         if (isset($post['product_manufacturer_id']) && $post['product_manufacturer_id'] != -1) {
             $product->set('product_manufacturer_id', $post['product_manufacturer_id']);
         }
         if (isset($post['vendor_id']) && $post['vendor_id'] != -1) {
             $product->set('vendor_id', $post['vendor_id']);
         }
         if (isset($post['delivery_times_id']) && $post['delivery_times_id'] != -1) {
             $product->set('delivery_times_id', $post['delivery_times_id']);
         }
         if (isset($post['label_id']) && $post['label_id'] != -1) {
             $product->set('label_id', $post['label_id']);
         }
         if (isset($post['weight_volume_units']) && $post['weight_volume_units'] != "") {
             $product->set('weight_volume_units', $post['weight_volume_units']);
             $product->set('basic_price_unit_id', $post['basic_price_unit_id']);
         }
         if ($post['product_price'] != "") {
             $oldprice = $product->product_price;
             $price = $_products->getModPrice($product->product_price, saveAsPrice($post['product_price']), $post['mod_price']);
             $product->set('product_price', $price);
             if ($post['use_old_val_price'] == 1) {
                 $product->set('product_old_price', $oldprice);
             }
         }
         if (isset($post['product_old_price']) && $post['product_old_price'] != "") {
             $price = $_products->getModPrice($product->product_old_price, saveAsPrice($post['product_old_price']), $post['mod_old_price']);
             $product->set('product_old_price', $price);
         }
         if (isset($post['product_price']) && $post['product_price'] != "" || $post['product_old_price'] != "") {
             $product->set('currency_id', $post['currency_id']);
         }
         if (isset($post['category_id']) && $post['category_id']) {
             $_products->setCategoryToProduct($id, $post['category_id']);
         }
         if ($jshopConfig->admin_show_product_extra_field) {
             $_productfields = JSFactory::getModel("productFields");
             $list_productfields = $_productfields->getList(1);
             foreach ($list_productfields as $v) {
                 $_nef = 'extra_field_' . $v->id;
                 switch ($v->type) {
                     case 0:
                         if (isset($post['productfields'][$_nef]) and is_array($post['productfields'][$_nef]) and count($post['productfields'][$_nef]) > 0) {
                             if ($v->multilist == 1 || ($v->multilist == 0 and !in_array(0, $post['productfields'][$_nef]))) {
                                 $product->set($_nef, implode(',', $post['productfields'][$_nef]));
                             }
                         }
                         break;
                     case 1:
                         if (isset($post[$_nef]) and $post[$_nef] != '') {
                             $product->set($_nef, $post[$_nef]);
                         }
                         break;
                 }
             }
         }
         $_products->updatePriceAndQtyDependAttr($id, $post);
         $product->store();
         if ($post['product_price'] != "") {
             $mprice = $product->getMinimumPrice();
             $product->set('min_price', $mprice);
         }
         if (!$product->unlimited) {
             $qty = $product->getFullQty();
             $product->set('product_quantity', $qty);
         }
         $product->date_modify = getJsDate();
//.........这里部分代码省略.........
开发者ID:panickylemon,项目名称:joomlastayn,代码行数:101,代码来源:products.php

示例6: savePrices

 function savePrices($sh_pr_method_id, $array_post)
 {
     $db = JFactory::getDBO();
     $query = "DELETE FROM `#__jshopping_shipping_method_price_weight` WHERE `sh_pr_method_id` = '" . $db->escape($sh_pr_method_id) . "'";
     $db->setQuery($query);
     $db->query();
     if (!is_array($array_post['shipping_price'])) {
         return 0;
     }
     foreach ($array_post['shipping_price'] as $key => $value) {
         if (!$array_post['shipping_weight_from'][$key] && !$array_post['shipping_weight_to'][$key]) {
             continue;
         }
         $sh_method = JSFactory::getTable('shippingMethodPriceWeight', 'jshop');
         $sh_method->sh_pr_method_id = $sh_pr_method_id;
         $sh_method->shipping_price = saveAsPrice($array_post['shipping_price'][$key]);
         $sh_method->shipping_package_price = saveAsPrice($array_post['shipping_package_price'][$key]);
         $sh_method->shipping_weight_from = saveAsPrice($array_post['shipping_weight_from'][$key]);
         $sh_method->shipping_weight_to = saveAsPrice($array_post['shipping_weight_to'][$key]);
         if (!$sh_method->store()) {
             JError::raiseWarning("", "Error saving to database" . $sh_method->_db->stderr());
         }
     }
 }
开发者ID:arkane0906,项目名称:lasercut-bootstrap,代码行数:24,代码来源:shippings.php

示例7: result

 function result()
 {
     $mainframe = JFactory::getApplication();
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     $lang = JSFactory::getLang();
     $user = JFactory::getUser();
     $session = JFactory::getSession();
     $session->set("jshop_end_page_buy_product", $_SERVER['REQUEST_URI']);
     $session->set("jshop_end_page_list_product", $_SERVER['REQUEST_URI']);
     $params = $mainframe->getParams();
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadProductList', array());
     $product = JSFactory::getTable('product', 'jshop');
     $seo = JSFactory::getTable("seo", "jshop");
     $seodata = $seo->loadData("search-result");
     if (getThisURLMainPageShop()) {
         appendPathWay(_JSHOP_SEARCH);
         if ($seodata->title == "") {
             $seodata->title = _JSHOP_SEARCH;
         }
         setMetaData($seodata->title, $seodata->keyword, $seodata->description);
     } else {
         setMetaData($seodata->title, $seodata->keyword, $seodata->description, $params);
     }
     $post = JRequest::get('request');
     if (isset($post['setsearchdata']) && $post['setsearchdata'] == 1) {
         $session->set("jshop_end_form_data", $post);
     } else {
         $data = $session->get("jshop_end_form_data");
         if (count($data)) {
             $post = $data;
         }
     }
     $category_id = intval($post['category_id']);
     $manufacturer_id = intval($post['manufacturer_id']);
     if (isset($post['date_to'])) {
         $date_to = $post['date_to'];
     } else {
         $date_to = null;
     }
     if (isset($post['date_from'])) {
         $date_from = $post['date_from'];
     } else {
         $date_from = null;
     }
     if (isset($post['price_to'])) {
         $price_to = saveAsPrice($post['price_to']);
     } else {
         $price_to = null;
     }
     if (isset($post['price_from'])) {
         $price_from = saveAsPrice($post['price_from']);
     } else {
         $price_from = null;
     }
     if (isset($post['include_subcat'])) {
         $include_subcat = intval($post['include_subcat']);
     } else {
         $include_subcat = 0;
     }
     $search = trim($post['search']);
     $search_type = $post['search_type'];
     if (!$search_type) {
         $search_type = "any";
     }
     $context = "jshoping.searclist.front.product";
     $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', $jshopConfig->count_products_to_page, 'int');
     if (!$limit) {
         $limit = $jshopConfig->count_products_to_page;
     }
     $limitstart = JRequest::getInt('limitstart', 0);
     if ($order == 4) {
         $order = 1;
     }
     if ($jshopConfig->admin_show_product_extra_field) {
         if (isset($post['extra_fields'])) {
             $extra_fields = $post['extra_fields'];
         } else {
             $extra_fields = array();
         }
         $extra_fields = filterAllowValue($extra_fields, "array_int_k_v+");
     }
     $categorys = array();
     if ($category_id) {
         if ($include_subcat) {
             $_category = JSFactory::getTable('category', 'jshop');
             $all_categories = $_category->getAllCategories();
             $cat_search[] = $category_id;
             searchChildCategories($category_id, $all_categories, $cat_search);
             foreach ($cat_search as $key => $value) {
                 $categorys[] = $value;
             }
         } else {
             $categorys[] = $category_id;
         }
     }
     $orderbyq = getQuerySortDirection($order, $orderby);
//.........这里部分代码省略.........
开发者ID:olegverstka,项目名称:monax.dev,代码行数:101,代码来源:search.php

示例8: save

 function save()
 {
     $sh_method_id = JRequest::getInt("sh_method_id");
     $shipping_id_back = JRequest::getInt("shipping_id_back");
     $dispatcher = JDispatcher::getInstance();
     $shippings = JSFactory::getModel("shippings");
     $shipping_pr = JSFactory::getTable('shippingMethodPrice', 'jshop');
     $post = JRequest::get("post");
     $post['shipping_stand_price'] = saveAsPrice($post['shipping_stand_price']);
     $dispatcher->trigger('onBeforeSaveShippingPrice', array(&$post));
     $countries = JRequest::getVar('shipping_countries_id');
     if (!$shipping_pr->bind($post)) {
         JError::raiseWarning("", _JSHOP_ERROR_BIND);
         $this->setRedirect("index.php?option=com_jshopping&controller=shippingsprices");
         return 0;
     }
     if (isset($post['sm_params'])) {
         $shipping_pr->setParams($post['sm_params']);
     } else {
         $shipping_pr->setParams('');
     }
     if (!$shipping_pr->store()) {
         JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
         $this->setRedirect("index.php?option=com_jshopping&controller=shippingsprices");
         return 0;
     }
     $shippings->savePrices($shipping_pr->sh_pr_method_id, $post);
     $shippings->saveCountries($shipping_pr->sh_pr_method_id, $countries);
     $dispatcher->trigger('onAfterSaveShippingPrice', array(&$shipping_pr));
     if ($this->getTask() == 'apply') {
         $this->setRedirect("index.php?option=com_jshopping&controller=shippingsprices&task=edit&sh_pr_method_id=" . $shipping_pr->sh_pr_method_id . "&shipping_id_back=" . $shipping_id_back);
     } else {
         $this->setRedirect("index.php?option=com_jshopping&controller=shippingsprices&shipping_id_back=" . $shipping_id_back);
     }
 }
开发者ID:olegverstka,项目名称:monax.dev,代码行数:35,代码来源:shippingsprices.php

示例9: save

 function save()
 {
     $back_tax_id = JRequest::getInt("back_tax_id");
     $id = JRequest::getInt("id");
     $tax = JSFactory::getTable('taxExt', 'jshop');
     $post = JRequest::get("post");
     $post['tax'] = saveAsPrice($post['tax']);
     $post['firma_tax'] = saveAsPrice($post['firma_tax']);
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeSaveExtTax', array(&$post));
     if (!$tax->bind($post)) {
         JError::raiseWarning("", _JSHOP_ERROR_BIND);
         $this->setRedirect("index.php?option=com_jshopping&controller=exttaxes&back_tax_id=" . $back_tax_id);
         return 0;
     }
     $tax->setZones($post['countries_id']);
     if (!$tax->store()) {
         JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
         $this->setRedirect("index.php?option=com_jshopping&controller=exttaxes&back_tax_id=" . $back_tax_id);
         return 0;
     }
     updateCountExtTaxRule();
     $dispatcher->trigger('onAfterSaveExtTax', array(&$tax));
     if ($this->getTask() == 'apply') {
         $this->setRedirect("index.php?option=com_jshopping&controller=exttaxes&task=edit&id=" . $tax->id . "&back_tax_id=" . $back_tax_id);
     } else {
         $this->setRedirect("index.php?option=com_jshopping&controller=exttaxes&back_tax_id=" . $back_tax_id);
     }
 }
开发者ID:olegverstka,项目名称:monax.dev,代码行数:29,代码来源:exttaxes.php

示例10: updatePriceAndQtyDependAttr

 function updatePriceAndQtyDependAttr($product_id, $post)
 {
     $db = JFactory::getDBO();
     $_adv_query = array();
     if ($post['product_price'] != "") {
         $price = saveAsPrice($post['product_price']);
         if ($post['mod_price'] == '%') {
             $_adv_query[] = " `price`=`price` * '" . $price . "' / 100 ";
         } elseif ($post['mod_price'] == '=') {
             $_adv_query[] = " `price`= '" . $price . "' ";
         } else {
             $_adv_query[] = " `price`=`price` " . $post['mod_price'] . " '" . $price . "' ";
         }
     }
     if ($post['product_old_price'] != "") {
         $price = saveAsPrice($post['product_old_price']);
         if ($post['mod_old_price'] == '%') {
             $_adv_query[] = " `old_price`=`old_price` * '" . $price . "' / 100 ";
         } elseif ($post['mod_old_price'] == '=') {
             $_adv_query[] = " `old_price`= '" . $price . "' ";
         } else {
             $_adv_query[] = " `old_price`=`old_price` " . $post['mod_old_price'] . " '" . $price . "' ";
         }
     }
     if ($post['product_quantity'] != "") {
         $_adv_query[] = " `count`= '" . $db->escape($post['product_quantity']) . "' ";
     }
     if (count($_adv_query) > 0) {
         $adv_query = implode(" , ", $_adv_query);
         $query = "update `#__jshopping_products_attr` SET " . $adv_query . " where product_id='" . $db->escape($product_id) . "'";
         $db->setQuery($query);
         $db->query();
     }
 }
开发者ID:Tommar,项目名称:vino2,代码行数:34,代码来源:products.php

示例11: save

 function save()
 {
     $jshopConfig = JSFactory::getConfig();
     require_once $jshopConfig->path . 'lib/image.lib.php';
     require_once $jshopConfig->path . 'lib/uploadfile.class.php';
     $dispatcher = JDispatcher::getInstance();
     $db = JFactory::getDBO();
     $post = JRequest::get('post');
     $_products = JSFactory::getModel("products");
     $product = JSFactory::getTable('product', 'jshop');
     $_alias = JSFactory::getModel("alias");
     $_lang = JSFactory::getModel("languages");
     $id_vendor_cuser = getIdVendorForCUser();
     if ($id_vendor_cuser && $post['product_id']) {
         checkAccessVendorToProduct($id_vendor_cuser, $post['product_id']);
     }
     $post['different_prices'] = 0;
     if (isset($post['product_is_add_price']) && $post['product_is_add_price']) {
         $post['different_prices'] = 1;
     }
     if (!isset($post['product_publish'])) {
         $post['product_publish'] = 0;
     }
     if (!isset($post['product_is_add_price'])) {
         $post['product_is_add_price'] = 0;
     }
     if (!isset($post['unlimited'])) {
         $post['unlimited'] = 0;
     }
     $post['product_price'] = saveAsPrice($post['product_price']);
     $post['product_old_price'] = saveAsPrice($post['product_old_price']);
     if (isset($post['product_buy_price'])) {
         $post['product_buy_price'] = saveAsPrice($post['product_buy_price']);
     } else {
         $post['product_buy_price'] = null;
     }
     $post['product_weight'] = saveAsPrice($post['product_weight']);
     if (!isset($post['related_products'])) {
         $post['related_products'] = array();
     }
     if (!$post['product_id']) {
         $post['product_date_added'] = getJsDate();
     }
     if (!isset($post['attrib_price'])) {
         $post['attrib_price'] = null;
     }
     if (!isset($post['attrib_ind_id'])) {
         $post['attrib_ind_id'] = null;
     }
     if (!isset($post['attrib_ind_price'])) {
         $post['attrib_ind_price'] = null;
     }
     if (!isset($post['attrib_ind_price_mod'])) {
         $post['attrib_ind_price_mod'] = null;
     }
     if (!isset($post['freeattribut'])) {
         $post['freeattribut'] = null;
     }
     $post['date_modify'] = getJsDate();
     $post['edit'] = intval($post['product_id']);
     if (!isset($post['product_add_discount'])) {
         $post['product_add_discount'] = 0;
     }
     $post['min_price'] = $_products->getMinimalPrice($post['product_price'], $post['attrib_price'], array($post['attrib_ind_id'], $post['attrib_ind_price_mod'], $post['attrib_ind_price']), $post['product_is_add_price'], $post['product_add_discount']);
     if ($id_vendor_cuser) {
         $post['vendor_id'] = $id_vendor_cuser;
     }
     if (isset($post['attr_count']) && is_array($post['attr_count'])) {
         $qty = 0;
         foreach ($post['attr_count'] as $key => $_qty) {
             $post['attr_count'][$key] = saveAsPrice($_qty);
             if ($_qty > 0) {
                 $qty += $post['attr_count'][$key];
             }
         }
         $post['product_quantity'] = $qty;
     }
     if ($post['unlimited']) {
         $post['product_quantity'] = 1;
     }
     $post['product_quantity'] = saveAsPrice($post['product_quantity']);
     if (isset($post['productfields']) && is_array($post['productfields'])) {
         foreach ($post['productfields'] as $productfield => $val) {
             if (is_array($val)) {
                 $post[$productfield] = implode(',', $val);
             }
         }
     }
     if ($jshopConfig->admin_show_product_extra_field) {
         $_productfields = JSFactory::getModel("productFields");
         $list_productfields = $_productfields->getList(1);
         foreach ($list_productfields as $v) {
             if ($v->type == 0 && !isset($post['extra_field_' . $v->id])) {
                 $post['extra_field_' . $v->id] = '';
             }
         }
     }
     if (is_array($post['attrib_price'])) {
         if (count(array_unique($post['attrib_price'])) > 1) {
             $post['different_prices'] = 1;
//.........这里部分代码省略.........
开发者ID:panickylemon,项目名称:joomlastayn,代码行数:101,代码来源:products.php

示例12: save

 function save()
 {
     $payment_id = JRequest::getInt("payment_id");
     JPluginHelper::importPlugin('jshoppingadmin');
     $dispatcher = JDispatcher::getInstance();
     $db = JFactory::getDBO();
     $payment = JTable::getInstance('paymentMethod', 'jshop');
     $post = JRequest::get("post");
     if (!isset($post['payment_publish'])) {
         $post['payment_publish'] = 0;
     }
     if (!isset($post['show_descr_in_email'])) {
         $post['show_descr_in_email'] = 0;
     }
     $post['price'] = saveAsPrice($post['price']);
     $post['payment_class'] = JRequest::getCmd("payment_class");
     if (!$post['payment_id']) {
         $post['payment_type'] = 1;
     }
     $dispatcher->trigger('onBeforeSavePayment', array(&$post));
     $_lang = $this->getModel("languages");
     $languages = $_lang->getAllLanguages(1);
     foreach ($languages as $lang) {
         $post['description_' . $lang->language] = JRequest::getVar('description' . $lang->id, '', 'post', "string", 2);
     }
     $payment->bind($post);
     $_payments = $this->getModel("payments");
     if (!$payment->payment_id) {
         $payment->payment_ordering = $_payments->getMaxOrdering() + 1;
     }
     if (isset($post['pm_params'])) {
         $parseString = new parseString($post['pm_params']);
         $payment->payment_params = $parseString->splitParamsToString();
     }
     if (!$payment->check()) {
         JError::raiseWarning("", $payment->getError());
         $this->setRedirect("index.php?option=com_jshopping&controller=payments&task=edit&payment_id=" . $payment->payment_id);
         return 0;
     }
     $payment->store();
     $dispatcher->trigger('onAfterSavePayment', array(&$payment));
     if ($this->getTask() == 'apply') {
         $this->setRedirect("index.php?option=com_jshopping&controller=payments&task=edit&payment_id=" . $payment->payment_id);
     } else {
         $this->setRedirect("index.php?option=com_jshopping&controller=payments");
     }
 }
开发者ID:ngogiangthanh,项目名称:damtvnewversion,代码行数:47,代码来源:payments.php

示例13: productGroupUpdate

 function productGroupUpdate($id, $post)
 {
     $jshopConfig = JSFactory::getConfig();
     $product = JSFactory::getTable('product', 'jshop');
     $product->load($id);
     if ($post['access'] != -1) {
         $product->set('access', $post['access']);
     }
     if ($post['product_publish'] != -1) {
         $product->set('product_publish', $post['product_publish']);
     }
     if ($post['product_weight'] != "") {
         $product->set('product_weight', $post['product_weight']);
     }
     if ($post['product_quantity'] != "") {
         $product->set('product_quantity', $post['product_quantity']);
         $product->set('unlimited', 0);
     }
     if (isset($post['unlimited']) && $post['unlimited']) {
         $product->set('product_quantity', 1);
         $product->set('unlimited', 1);
     }
     if (isset($post['product_template']) && $post['product_template'] != -1) {
         $product->set('product_template', $post['product_template']);
     }
     if (isset($post['product_tax_id']) && $post['product_tax_id'] != -1) {
         $product->set('product_tax_id', $post['product_tax_id']);
     }
     if (isset($post['product_manufacturer_id']) && $post['product_manufacturer_id'] != -1) {
         $product->set('product_manufacturer_id', $post['product_manufacturer_id']);
     }
     if (isset($post['vendor_id']) && $post['vendor_id'] != -1) {
         $product->set('vendor_id', $post['vendor_id']);
     }
     if (isset($post['delivery_times_id']) && $post['delivery_times_id'] != -1) {
         $product->set('delivery_times_id', $post['delivery_times_id']);
     }
     if (isset($post['label_id']) && $post['label_id'] != -1) {
         $product->set('label_id', $post['label_id']);
     }
     if (isset($post['weight_volume_units']) && $post['weight_volume_units'] != "") {
         $product->set('weight_volume_units', $post['weight_volume_units']);
         $product->set('basic_price_unit_id', $post['basic_price_unit_id']);
     }
     if ($post['product_price'] != "") {
         $oldprice = $product->product_price;
         $price = $this->getModPrice($product->product_price, saveAsPrice($post['product_price']), $post['mod_price']);
         $product->set('product_price', $price);
         if ($post['use_old_val_price'] == 1) {
             $product->set('product_old_price', $oldprice);
         }
     }
     if (isset($post['product_old_price']) && $post['product_old_price'] != "") {
         $price = $this->getModPrice($product->product_old_price, saveAsPrice($post['product_old_price']), $post['mod_old_price']);
         $product->set('product_old_price', $price);
     }
     if (isset($post['product_buy_price']) && $post['product_buy_price'] != "") {
         $product->set('product_buy_price', $post['product_buy_price']);
     }
     if (isset($post['product_price']) && $post['product_price'] != "" || $post['product_old_price'] != "") {
         $product->set('currency_id', $post['currency_id']);
     }
     if (isset($post['category_id']) && $post['category_id']) {
         $this->setCategoryToProduct($id, $post['category_id']);
     }
     if ($jshopConfig->admin_show_product_extra_field) {
         $_productfields = JSFactory::getModel("productFields");
         $list_productfields = $_productfields->getList(1);
         foreach ($list_productfields as $v) {
             $_nef = 'extra_field_' . $v->id;
             switch ($v->type) {
                 case 0:
                     if (isset($post['productfields'][$_nef]) and is_array($post['productfields'][$_nef]) and count($post['productfields'][$_nef]) > 0) {
                         if ($v->multilist == 1 || ($v->multilist == 0 and !in_array(0, $post['productfields'][$_nef]))) {
                             $product->set($_nef, implode(',', $post['productfields'][$_nef]));
                         }
                     }
                     break;
                 case 1:
                     if (isset($post[$_nef]) and $post[$_nef] != '') {
                         $product->set($_nef, $post[$_nef]);
                     }
                     break;
             }
         }
     }
     $this->updatePriceAndQtyDependAttr($id, $post);
     $product->store();
     if ($post['product_price'] != "") {
         $mprice = $product->getMinimumPrice();
         $product->set('min_price', $mprice);
     }
     if (!$product->unlimited) {
         $qty = $product->getFullQty();
         $product->set('product_quantity', $qty);
     }
     $product->date_modify = getJsDate();
     extract(js_add_trigger(get_defined_vars(), "beforeStore"));
     $product->store();
 }
开发者ID:panickylemon,项目名称:joomlastayn,代码行数:100,代码来源:products.php

示例14: getBuildFilterListProduct

function getBuildFilterListProduct($contextfilter, $no_filter = array())
{
    $mainframe = JFactory::getApplication();
    $jshopConfig = JSFactory::getConfig();
    $category_id = JRequest::getInt('category_id');
    $manufacturer_id = JRequest::getInt('manufacturer_id');
    $label_id = JRequest::getInt('label_id');
    $vendor_id = JRequest::getInt('vendor_id');
    $price_from = saveAsPrice(JRequest::getVar('price_from'));
    $price_to = saveAsPrice(JRequest::getVar('price_to'));
    $categorys = $mainframe->getUserStateFromRequest($contextfilter . 'categorys', 'categorys', array());
    $categorys = filterAllowValue($categorys, "int+");
    $tmpcd = getListFromStr(JRequest::getVar('category_id'));
    if (is_array($tmpcd) && !$categorys) {
        $categorys = $tmpcd;
    }
    $manufacturers = $mainframe->getUserStateFromRequest($contextfilter . 'manufacturers', 'manufacturers', array());
    $manufacturers = filterAllowValue($manufacturers, "int+");
    $tmp = getListFromStr(JRequest::getVar('manufacturer_id'));
    if (is_array($tmp) && !$manufacturers) {
        $manufacturers = $tmp;
    }
    $labels = $mainframe->getUserStateFromRequest($contextfilter . 'labels', 'labels', array());
    $labels = filterAllowValue($labels, "int+");
    $tmplb = getListFromStr(JRequest::getVar('label_id'));
    if (is_array($tmplb) && !$labels) {
        $labels = $tmplb;
    }
    $vendors = $mainframe->getUserStateFromRequest($contextfilter . 'vendors', 'vendors', array());
    $vendors = filterAllowValue($vendors, "int+");
    $tmp = getListFromStr(JRequest::getVar('vendor_id'));
    if (is_array($tmp) && !$vendors) {
        $vendors = $tmp;
    }
    if ($jshopConfig->admin_show_product_extra_field) {
        $extra_fields = $mainframe->getUserStateFromRequest($contextfilter . 'extra_fields', 'extra_fields', array());
        $extra_fields = filterAllowValue($extra_fields, "array_int_k_v+");
    }
    $fprice_from = $mainframe->getUserStateFromRequest($contextfilter . 'fprice_from', 'fprice_from');
    $fprice_from = saveAsPrice($fprice_from);
    if (!$fprice_from) {
        $fprice_from = $price_from;
    }
    $fprice_to = $mainframe->getUserStateFromRequest($contextfilter . 'fprice_to', 'fprice_to');
    $fprice_to = saveAsPrice($fprice_to);
    if (!$fprice_to) {
        $fprice_to = $price_to;
    }
    $filters = array();
    $filters['categorys'] = $categorys;
    $filters['manufacturers'] = $manufacturers;
    $filters['price_from'] = $fprice_from;
    $filters['price_to'] = $fprice_to;
    $filters['labels'] = $labels;
    $filters['vendors'] = $vendors;
    if ($jshopConfig->admin_show_product_extra_field) {
        $filters['extra_fields'] = $extra_fields;
    }
    if ($category_id && !$filters['categorys']) {
        $filters['categorys'][] = $category_id;
    }
    if ($manufacturer_id && !$filters['manufacturers']) {
        $filters['manufacturers'][] = $manufacturer_id;
    }
    if ($label_id && !$filters['labels']) {
        $filters['labels'][] = $label_id;
    }
    if ($vendor_id && !$filters['vendors']) {
        $filters['vendors'][] = $vendor_id;
    }
    if (is_array($filters['vendors'])) {
        $main_vendor = JSFactory::getMainVendor();
        foreach ($filters['vendors'] as $vid) {
            if ($vid == $main_vendor->id) {
                $filters['vendors'][] = 0;
            }
        }
    }
    foreach ($no_filter as $filterkey) {
        unset($filters[$filterkey]);
    }
    JPluginHelper::importPlugin('jshoppingproducts');
    $dispatcher = JDispatcher::getInstance();
    $dispatcher->trigger('afterGetBuildFilterListProduct', array(&$filters));
    return $filters;
}
开发者ID:JexyRu,项目名称:jshop-updates,代码行数:86,代码来源:functions.php

示例15: save

 function save()
 {
     $coupon_id = JRequest::getInt("coupon_id");
     $coupon = JSFactory::getTable('coupon', 'jshop');
     $dispatcher = JDispatcher::getInstance();
     $post = JRequest::get("post");
     $post['coupon_code'] = JRequest::getCmd("coupon_code");
     $post['coupon_publish'] = JRequest::getInt("coupon_publish");
     $post['finished_after_used'] = JRequest::getInt("finished_after_used");
     $post['coupon_value'] = saveAsPrice($post['coupon_value']);
     $dispatcher->trigger('onBeforeSaveCoupon', array(&$post));
     if (!$post['coupon_code']) {
         JError::raiseWarning("", _JSHOP_ERROR_COUPON_CODE);
         $this->setRedirect("index.php?option=com_jshopping&controller=coupons&task=edit&coupon_id=" . $coupon->coupon_id);
         return 0;
     }
     if ($post['coupon_value'] < 0 || $post['coupon_value'] > 100 && $post['coupon_type'] == 0) {
         JError::raiseWarning("", _JSHOP_ERROR_COUPON_VALUE);
         $this->setRedirect("index.php?option=com_jshopping&controller=coupons&task=edit&coupon_id=" . $coupon->coupon_id);
         return 0;
     }
     if (!$coupon->bind($post)) {
         JError::raiseWarning("", _JSHOP_ERROR_BIND);
         $this->setRedirect("index.php?option=com_jshopping&controller=coupons");
         return 0;
     }
     if ($coupon->getExistCode()) {
         JError::raiseWarning("", _JSHOP_ERROR_COUPON_EXIST);
         $this->setRedirect("index.php?option=com_jshopping&controller=coupons");
         return 0;
     }
     if (!$coupon->store()) {
         JError::raiseWarning("", _JSHOP_ERROR_SAVE_DATABASE);
         $this->setRedirect("index.php?option=com_jshopping&controller=coupons");
         return 0;
     }
     $dispatcher->trigger('onAfterSaveCoupon', array(&$coupon));
     if ($this->getTask() == 'apply') {
         $this->setRedirect("index.php?option=com_jshopping&controller=coupons&task=edit&coupon_id=" . $coupon->coupon_id);
     } else {
         $this->setRedirect("index.php?option=com_jshopping&controller=coupons");
     }
 }
开发者ID:arkane0906,项目名称:lasercut-bootstrap,代码行数:43,代码来源:coupons.php


注:本文中的saveAsPrice函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。