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


PHP Pack类代码示例

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


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

示例1: packageDetailsFromRow

 private function packageDetailsFromRow($row)
 {
     $pack = new Pack();
     $pack->sp_pkg_id = $row['sp_pkg_id'];
     $pack->sp_st_id = $row['sp_st_id'];
     $pack->sp_dc_id = $row['sp_dc_id'];
     $pack->sp_pkg_type = $row['sp_pkg_type'];
     $pack->sp_package_name = $row['sp_package_name'];
     $pack->sp_package_desc = $row['sp_package_desc'];
     $pack->sp_parent_pkg_id = $row['sp_parent_pkg_id'];
     $pack->sp_pk_id = $row['sp_pk_id'];
     $pack->pk_name = $row['pk_name'];
     $pack->pk_desc = $row['pk_desc'];
     $pack->pk_cnt_display_opt = $row['pk_cnt_display_opt'];
     $pack->cm_id = $row['cm_id'];
     $pack->cm_content_type = $row['cm_content_type'];
     $pack->cm_title = $row['cm_title'];
     $pack->cm_vendor = $row['cm_vendor'];
     $pack->cm_property_id = $row['cm_property_id'];
     $pack->cd_name = $row['cd_name'];
     $pack->cft_thumbnail_img_browse = $row['cft_thumbnail_img_browse'];
     $pack->cft_thumbnail_size = $row['cft_thumbnail_size'];
     $pack->cf_template_id = $row['cf_template_id'];
     $pack->cm_streaming_url = $row['cm_streaming_url'];
     $pack->cm_downloading_url = $row['cm_downloading_url'];
     $pack->unsetValues(array('created_on', 'updated_on', 'created_by', 'updated_by'));
     return $pack;
 }
开发者ID:sujata-patne,项目名称:icon_api,代码行数:28,代码来源:PackDao.php

示例2: submit

 public function submit($song_id = null)
 {
     $this->require_login();
     if (!$song_id) {
         $this->content_view = "scores/submit";
         $this->data['songs'] = Ranked_file::get_all_charts();
         $this->data['packs'] = Pack::all(array('order' => 'name asc'));
     } else {
         if (Ranked_file::count(array('conditions' => array('id = ?', $song_id))) != 1) {
             redirect('scores/submit');
         } else {
             if ($_POST) {
                 $song = Ranked_file::find($song_id);
                 $this->data['song'] = $song;
                 $total_notes = $this->input->post('marvelous_count') + $this->input->post('perfect_count') + $this->input->post('great_count') + $this->input->post('good_count') + $this->input->post('boo_count') + $this->input->post('miss_count');
                 $total_holds = $this->input->post('ok_count');
                 if ($total_notes > $song->taps || $total_holds > $song->holds) {
                     $this->content_view = "scores/confirm";
                     $this->data['error_nc'] = true;
                 } elseif ($this->form_validation->run('submit_score') == FALSE) {
                     $this->content_view = "scores/confirm";
                     $this->data['error'] = true;
                 } else {
                     $attributes = array('user_id' => $this->session->userdata('user_id'), 'file_id' => $song_id, 'date_achieved' => $this->input->post('score_achieved'), 'marvelous_count' => $this->input->post('marvelous_count'), 'perfect_count' => $this->input->post('perfect_count'), 'great_count' => $this->input->post('great_count'), 'good_count' => $this->input->post('good_count'), 'boo_count' => $this->input->post('boo_count'), 'miss_count' => $this->input->post('miss_count'), 'ok_count' => $this->input->post('ok_count'), 'mines_hit' => $this->input->post('mines_hit'), 'screenshot_url' => $this->input->post('screenshot_url'));
                     $new_score = new User_score($attributes);
                     $new_score->save();
                     // Check if score is below AA
                     $max_dp_max = $song->dance_points;
                     $max_dp_achieved = $new_score->marvelous_count * 2 + $new_score->perfect_count * 2 + $new_score->great_count * 1 + $new_score->boo_count * -4 + $new_score->miss_count * -8 + $new_score->ok_count * 6 + $new_score->mines_hit * -8;
                     $max_dp_percent = $max_dp_achieved / $max_dp_max * 100;
                     if ($max_dp_percent < 93) {
                         $new_score->status = "below_aa";
                         $new_score->save();
                     }
                     // Check if score is in top 10% of all scores
                     $this->data['score_pending'] = false;
                     $percentile = User_score::get_top_10_percentile();
                     if ($song->difficulty_score > $percentile) {
                         $new_score->status = "pending";
                         $new_score->was_pending = 1;
                         $new_score->save();
                         $this->data['score_pending'] = true;
                     }
                     $this->content_view = "scores/success";
                 }
             } else {
                 $this->data['song'] = Ranked_file::find($song_id);
                 $this->content_view = "scores/confirm";
                 $this->data['error'] = false;
             }
         }
     }
 }
开发者ID:samoldenburg,项目名称:Stepmania-Leaderboards,代码行数:53,代码来源:Scores.php

示例3: index

 public function index()
 {
     error_reporting(0);
     $this->content_view = 'home';
     $this->data['announcements'] = Announcement::get_announcements();
     $this->load->helper('twitch');
     load_api_interface();
     $result = json_decode(file_get_contents("https://api.twitch.tv/kraken/streams?game=StepMania&limit=4"));
     $this->data['streams'] = $result->streams;
     $this->data['recent_scores'] = User_score::get_recent_scores();
     $this->data['new_songs'] = Ranked_file::get_recent_files();
     $this->data['new_packs'] = Pack::get_recent_packs();
     $this->data['online_users'] = User::get_online_users();
     $this->data['leaderboards'] = Leaderboards_cache::get_all_lbs();
 }
开发者ID:samoldenburg,项目名称:Stepmania-Leaderboards,代码行数:15,代码来源:Home.php

示例4: view

 public function view($id = null)
 {
     if (empty($id)) {
         redirect('charts');
     } else {
         if (Ranked_file::count(array('conditions' => array('id = ?', $id))) == 0) {
             redirect('charts');
         } else {
             error_reporting(E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_WARNING);
             $file = Ranked_file::find($id);
             $pack = Pack::find($file->pack_id);
             $this->data['user_scores'] = User_score::get_scores_for_chart($id);
             $this->data['pack'] = $pack;
             $this->data['subtitle'] = $file->title;
             $this->_process_everything($file->raw_file, $file->rate);
         }
     }
 }
开发者ID:samoldenburg,项目名称:Stepmania-Leaderboards,代码行数:18,代码来源:Charts.php

示例5: getPacksTable

 public static function getPacksTable($id_product, $id_lang, $full = false, $limit = NULL)
 {
     $price_sql = Product::getProductPriceSql('p.id_product', 'pp');
     $sql = "\n\t\t SELECT\n                  p.*, pl.*, i.`id_image`, il.`legend`, t.`rate`\n\t\t FROM\n                  `PREFIX_product` p\n\t\t  NATURAL LEFT JOIN `PREFIX_product_lang` pl\n\t\t  LEFT JOIN `PREFIX_image` i ON\n                   i.`id_product` = p.`id_product` AND i.`cover` = 1\n\t\t  LEFT JOIN `PREFIX_image_lang` il ON\n                   i.`id_image` = il.`id_image` AND il.`id_lang` = {$id_lang}\n                  {$price_sql}\n\t\t  LEFT JOIN `PREFIX_tax` t ON\n                   t.`id_tax` = pp.`id_tax`\n\t\t WHERE pl.`id_lang` = {$id_lang}\n\t\t AND p.`id_product` IN (\n\t\t\t SELECT a.`id_product_pack`\n\t\t\t FROM `PREFIX_pack` a\n\t\t\t WHERE a.`id_product_item` = {$id_product})\n\t\t";
     $sql = str_replace('PREFIX_', _DB_PREFIX_, $sql);
     $result = Db::getInstance()->ExecuteS($sql);
     if ($limit) {
         $sql .= ' LIMIT ' . intval($limit);
     }
     $result = Db::getInstance()->ExecuteS($sql);
     if (!$full) {
         return $result;
     }
     $arrayResult = array();
     foreach ($result as $row) {
         if (!Pack::isPacked($row['id_product'])) {
             $arrayResult[] = Product::getProductProperties($id_lang, $row);
         }
     }
     return $arrayResult;
 }
开发者ID:redb,项目名称:prestashop,代码行数:21,代码来源:Pack.php

示例6: view

 public function view($id = null)
 {
     if (empty($id)) {
         redirect('packs');
     } else {
         if (Pack::count(array('conditions' => array('id = ?', $id))) == 0) {
             redirect('packs');
         } else {
             $this->data['pack'] = Pack::get_single_pack_info($id);
             $this->data['subtitle'] = $this->data['pack']->name;
             $this->data['songs'] = Ranked_file::all(array('conditions' => array("pack_id = ?", $id), 'order' => "rate ASC"));
             if (isset($_GET['recalc'])) {
                 error_reporting(E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_WARNING);
                 set_time_limit(0);
                 foreach ($this->data['songs'] as $file) {
                     $calculated_difficulty = $this->_process_everything($file->raw_file, $file->rate);
                     $file->difficulty_score = $calculated_difficulty;
                 }
             }
             $this->content_view = 'packs/view';
         }
     }
 }
开发者ID:samoldenburg,项目名称:Stepmania-Leaderboards,代码行数:23,代码来源:Packs.php

示例7: indexAction

 public function indexAction($packID)
 {
     if (!Validator::isValidID($packID)) {
         echo 'nooo';
         die;
     }
     $pack = Pack::findFirst($packID);
     echo $pack->name, '<br><br>';
     /** @var \Phalcon\Db\Adapter\Pdo $db */
     $db = $this->getDI()['db'];
     $sql = "SELECT t.id, t.metaID, tm.name FROM Texture t INNER JOIN TextureMeta tm ON t.metaID = tm.id WHERE t.packID = ?";
     $statement = $db->prepare($sql);
     $statement->execute([$packID]);
     $statement->setFetchMode(PDO::FETCH_OBJ);
     $texturesByTMID = array();
     while ($texture = $statement->fetch()) {
         $texturesByTMID[$texture->metaID][] = $texture;
     }
     foreach ($texturesByTMID as $tmID => $textures) {
         $renderer = new PickerRenderer($packID);
         $renderer->render($textures[0]->name, $textures);
     }
 }
开发者ID:noikiy,项目名称:mcc,代码行数:23,代码来源:PackController.php

示例8: usesAdvancedStockManagement

 /**
  * For a given pack, tells if it has at least one product using the advanced stock management
  *
  * @param int $id_product id_pack
  * @return bool
  */
 public static function usesAdvancedStockManagement($id_product)
 {
     if (!Pack::isPack($id_product)) {
         return false;
     }
     $products = Pack::getItems($id_product, Configuration::get('PS_LANG_DEFAULT'));
     foreach ($products as $product) {
         // if one product uses the advanced stock management
         if ($product->advanced_stock_management == 1) {
             return true;
         }
     }
     // not used
     return false;
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:21,代码来源:Pack.php

示例9: removeProduct

    /**
     * @see StockManagerInterface::removeProduct()
     */
    public function removeProduct($id_product, $id_product_attribute = null, Warehouse $warehouse, $quantity, $id_stock_mvt_reason, $is_usable = true, $id_order = null)
    {
        $return = array();
        if (!Validate::isLoadedObject($warehouse) || !$quantity || !$id_product) {
            return $return;
        }
        if (!StockMvtReason::exists($id_stock_mvt_reason)) {
            $id_stock_mvt_reason = Configuration::get('PS_STOCK_MVT_DEC_REASON_DEFAULT');
        }
        $context = Context::getContext();
        // Special case of a pack
        if (Pack::isPack((int) $id_product)) {
            // Gets items
            $products_pack = Pack::getItems((int) $id_product, (int) Configuration::get('PS_LANG_DEFAULT'));
            // Foreach item
            foreach ($products_pack as $product_pack) {
                $pack_id_product_attribute = Product::getDefaultAttribute($product_pack->id, 1);
                if ($product_pack->advanced_stock_management == 1) {
                    $this->removeProduct($product_pack->id, $pack_id_product_attribute, $warehouse, $product_pack->pack_quantity * $quantity, $id_stock_mvt_reason, $is_usable, $id_order);
                }
            }
        } else {
            // gets total quantities in stock for the current product
            $physical_quantity_in_stock = (int) $this->getProductPhysicalQuantities($id_product, $id_product_attribute, array($warehouse->id), false);
            $usable_quantity_in_stock = (int) $this->getProductPhysicalQuantities($id_product, $id_product_attribute, array($warehouse->id), true);
            // check quantity if we want to decrement unusable quantity
            if (!$is_usable) {
                $quantity_in_stock = $physical_quantity_in_stock - $usable_quantity_in_stock;
            } else {
                $quantity_in_stock = $usable_quantity_in_stock;
            }
            // checks if it's possible to remove the given quantity
            if ($quantity_in_stock < $quantity) {
                return $return;
            }
            $stock_collection = $this->getStockCollection($id_product, $id_product_attribute, $warehouse->id);
            $stock_collection->getAll();
            // check if the collection is loaded
            if (count($stock_collection) <= 0) {
                return $return;
            }
            $stock_history_qty_available = array();
            $mvt_params = array();
            $stock_params = array();
            $quantity_to_decrement_by_stock = array();
            $global_quantity_to_decrement = $quantity;
            // switch on MANAGEMENT_TYPE
            switch ($warehouse->management_type) {
                // case CUMP mode
                case 'WA':
                    // There is one and only one stock for a given product in a warehouse in this mode
                    $stock = $stock_collection->current();
                    $mvt_params = array('id_stock' => $stock->id, 'physical_quantity' => $quantity, 'id_stock_mvt_reason' => $id_stock_mvt_reason, 'id_order' => $id_order, 'price_te' => $stock->price_te, 'last_wa' => $stock->price_te, 'current_wa' => $stock->price_te, 'id_employee' => $context->employee->id, 'employee_firstname' => $context->employee->firstname, 'employee_lastname' => $context->employee->lastname, 'sign' => -1);
                    $stock_params = array('physical_quantity' => $stock->physical_quantity - $quantity, 'usable_quantity' => $is_usable ? $stock->usable_quantity - $quantity : $stock->usable_quantity);
                    // saves stock in warehouse
                    $stock->hydrate($stock_params);
                    $stock->update();
                    // saves stock mvt
                    $stock_mvt = new StockMvt();
                    $stock_mvt->hydrate($mvt_params);
                    $stock_mvt->save();
                    $return[$stock->id]['quantity'] = $quantity;
                    $return[$stock->id]['price_te'] = $stock->price_te;
                    break;
                case 'LIFO':
                case 'FIFO':
                    // for each stock, parse its mvts history to calculate the quantities left for each positive mvt,
                    // according to the instant available quantities for this stock
                    foreach ($stock_collection as $stock) {
                        $left_quantity_to_check = $stock->physical_quantity;
                        if ($left_quantity_to_check <= 0) {
                            continue;
                        }
                        $resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->query('
							SELECT sm.`id_stock_mvt`, sm.`date_add`, sm.`physical_quantity`,
								IF ((sm2.`physical_quantity` is null), sm.`physical_quantity`, (sm.`physical_quantity` - SUM(sm2.`physical_quantity`))) as qty
							FROM `' . _DB_PREFIX_ . 'stock_mvt` sm
							LEFT JOIN `' . _DB_PREFIX_ . 'stock_mvt` sm2 ON sm2.`referer` = sm.`id_stock_mvt`
							WHERE sm.`sign` = 1
							AND sm.`id_stock` = ' . (int) $stock->id . '
							GROUP BY sm.`id_stock_mvt`
							ORDER BY sm.`date_add` DESC');
                        while ($row = Db::getInstance()->nextRow($resource)) {
                            // break - in FIFO mode, we have to retreive the oldest positive mvts for which there are left quantities
                            if ($warehouse->management_type == 'FIFO') {
                                if ($row['qty'] == 0) {
                                    break;
                                }
                            }
                            // converts date to timestamp
                            $date = new DateTime($row['date_add']);
                            $timestamp = $date->format('U');
                            // history of the mvt
                            $stock_history_qty_available[$timestamp] = array('id_stock' => $stock->id, 'id_stock_mvt' => (int) $row['id_stock_mvt'], 'qty' => (int) $row['qty']);
                            // break - in LIFO mode, checks only the necessary history to handle the global quantity for the current stock
                            if ($warehouse->management_type == 'LIFO') {
                                $left_quantity_to_check -= (int) $row['physical_quantity'];
//.........这里部分代码省略.........
开发者ID:jicheng17,项目名称:vipinsg,代码行数:101,代码来源:StockManager.php

示例10: process

 public function process()
 {
     global $cart, $currency;
     parent::process();
     if (!($id_product = (int) Tools::getValue('id_product')) or !Validate::isUnsignedId($id_product)) {
         $this->errors[] = Tools::displayError('Product not found');
     } else {
         if (!Validate::isLoadedObject($this->product) or !$this->product->active and Tools::getValue('adtoken') != Tools::encrypt('PreviewProduct' . $this->product->id) || !file_exists(dirname(__FILE__) . '/../' . Tools::getValue('ad') . '/ajax.php')) {
             header('HTTP/1.1 404 page not found');
             $this->errors[] = Tools::displayError('Product is no longer available.');
         } elseif (!$this->product->checkAccess((int) self::$cookie->id_customer)) {
             $this->errors[] = Tools::displayError('You do not have access to this product.');
         } else {
             self::$smarty->assign('virtual', ProductDownload::getIdFromIdProduct((int) $this->product->id));
             if (!$this->product->active) {
                 self::$smarty->assign('adminActionDisplay', true);
             }
             /* rewrited url set */
             $rewrited_url = self::$link->getProductLink($this->product->id, $this->product->link_rewrite);
             /* Product pictures management */
             require_once 'images.inc.php';
             self::$smarty->assign('customizationFormTarget', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
             if (Tools::isSubmit('submitCustomizedDatas')) {
                 $this->pictureUpload($this->product, $cart);
                 $this->textRecord($this->product, $cart);
                 $this->formTargetFormat();
             } elseif (isset($_GET['deletePicture']) and !$cart->deletePictureToProduct((int) $this->product->id, (int) Tools::getValue('deletePicture'))) {
                 $this->errors[] = Tools::displayError('An error occurred while deleting the selected picture');
             }
             $files = self::$cookie->getFamily('pictures_' . (int) $this->product->id);
             $textFields = self::$cookie->getFamily('textFields_' . (int) $this->product->id);
             foreach ($textFields as $key => $textField) {
                 $textFields[$key] = str_replace('<br />', "\n", $textField);
             }
             self::$smarty->assign(array('pictures' => $files, 'textFields' => $textFields));
             if ((int) Tools::getValue('pp') == 1) {
                 echo 'here1';
             }
             $productPriceWithTax = Product::getPriceStatic($id_product, true, NULL, 6);
             if (Product::$_taxCalculationMethod == PS_TAX_INC) {
                 $productPriceWithTax = Tools::ps_round($productPriceWithTax, 2);
             }
             if ((int) Tools::getValue('pp') == 1) {
                 $time2 = time();
                 echo 'time2: ' . $time2;
             }
             $productPriceWithoutEcoTax = (double) ($productPriceWithTax - $this->product->ecotax);
             $configs = Configuration::getMultiple(array('PS_ORDER_OUT_OF_STOCK', 'PS_LAST_QTIES'));
             /* Features / Values */
             $features = $this->product->getFrontFeatures((int) self::$cookie->id_lang);
             $attachments = $this->product->getAttachments((int) self::$cookie->id_lang);
             /* Category */
             $category = false;
             if (isset($_SERVER['HTTP_REFERER']) and preg_match('!^(.*)\\/([0-9]+)\\-(.*[^\\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs) and !strstr($_SERVER['HTTP_REFERER'], '.html')) {
                 if (isset($regs[2]) and is_numeric($regs[2])) {
                     if (Product::idIsOnCategoryId((int) $this->product->id, array('0' => array('id_category' => (int) $regs[2])))) {
                         $category = new Category((int) $regs[2], (int) self::$cookie->id_lang);
                     }
                 } elseif (isset($regs[5]) and is_numeric($regs[5])) {
                     if (Product::idIsOnCategoryId((int) $this->product->id, array('0' => array('id_category' => (int) $regs[5])))) {
                         $category = new Category((int) $regs[5], (int) self::$cookie->id_lang);
                     }
                 }
             }
             if (!$category) {
                 $category = new Category($this->product->id_category_default, (int) self::$cookie->id_lang);
             }
             if (isset($category) and Validate::isLoadedObject($category)) {
                 self::$smarty->assign(array('path' => Tools::getPath((int) $category->id, $this->product->name, true), 'category' => $category, 'subCategories' => $category->getSubCategories((int) self::$cookie->id_lang, true), 'id_category_current' => (int) $category->id, 'id_category_parent' => (int) $category->id_parent, 'return_category_name' => Tools::safeOutput($category->name)));
             } else {
                 self::$smarty->assign('path', Tools::getPath((int) $this->product->id_category_default, $this->product->name));
             }
             self::$smarty->assign('return_link', (isset($category->id) and $category->id) ? Tools::safeOutput(self::$link->getCategoryLink($category)) : 'javascript: history.back();');
             $lang = Configuration::get('PS_LANG_DEFAULT');
             if (Pack::isPack((int) $this->product->id, (int) $lang) and !Pack::isInStock((int) $this->product->id, (int) $lang)) {
                 $this->product->quantity = 0;
             }
             $group_reduction = (100 - Group::getReduction((int) self::$cookie->id_customer)) / 100;
             $id_customer = (isset(self::$cookie->id_customer) and self::$cookie->id_customer) ? (int) self::$cookie->id_customer : 0;
             $id_group = $id_customer ? (int) Customer::getDefaultGroupId($id_customer) : _PS_DEFAULT_CUSTOMER_GROUP_;
             $id_country = (int) ($id_customer ? Customer::getCurrentCountry($id_customer) : Configuration::get('PS_COUNTRY_DEFAULT'));
             if ((int) Tools::getValue('pp') == 1) {
                 $time3 = time();
                 echo 'time3: ' . $time3;
             }
             // Tax
             $tax = (double) Tax::getProductTaxRate((int) $this->product->id, $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
             self::$smarty->assign('tax_rate', $tax);
             $ecotax_rate = (double) Tax::getProductEcotaxRate($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
             $ecotaxTaxAmount = Tools::ps_round($this->product->ecotax, 2);
             if (Product::$_taxCalculationMethod == PS_TAX_INC && (int) Configuration::get('PS_TAX')) {
                 $ecotaxTaxAmount = Tools::ps_round($ecotaxTaxAmount * (1 + $ecotax_rate / 100), 2);
             }
             $manufacturer = new Manufacturer((int) $this->product->id_manufacturer, 1);
             $sizechart = new Sizechart((int) $this->product->id_sizechart, 1);
             //see if the product is already in the wishlist
             if ($id_customer) {
                 $sql = "select id from ps_wishlist where id_customer = " . $id_customer . " and id_product = " . $this->product->id;
                 $res = Db::getInstance()->ExecuteS($sql);
                 if ($res) {
//.........这里部分代码省略.........
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:101,代码来源:ProductController_20aug_bkp.php

示例11: isPacked

 /**
  * Is this product in a pack?
  * If $id_product_attribute specified, then will restrict search on the given combination,
  * else this method will match a product if at least one of all its combination is in a pack.
  *
  * @param Product $product
  * @param integer $id_product_attribute Optional combination of the product
  * @return boolean
  */
 public function isPacked($product, $id_product_attribute = false)
 {
     return Pack::isPacked($product->id, $id_product_attribute);
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:13,代码来源:Adapter_PackItemsManager.php

示例12: update_cart_by_site_xml


//.........这里部分代码省略.........
                    $item_charge_type = (string) $amount_type->Type;
                    if ($item_charge_type == 'Principal') {
                        $principal = (string) $amount_type->Charge->Amount;
                    }
                    if ($item_charge_type == 'Shipping') {
                        $Shipping = (string) $amount_type->Charge->Amount;
                    }
                    if ($item_charge_type == 'PrincipalPromo') {
                        $principal_promo = (string) $amount_type->Charge->Amount;
                    }
                    if ($item_charge_type == 'ShippingPromo') {
                        $shipping_promo = (string) $amount_type->Charge->Amount;
                    }
                    if ($item_charge_type == 'OtherPromo') {
                        $other_promo = (string) $amount_type->Charge->Amount;
                    }
                }
                $sql = 'INSERT into `' . $prefix . 'order_detail` set
							`id_order` = ' . $order_id . ',
							`product_id` = ' . $product_id . ',
							`product_attribute_id` = ' . $product_attribute_id . ',
							`product_name` = "' . $Title . '",
							`product_quantity` = ' . $Quantity . ',
							`product_quantity_in_stock` = ' . $Quantity . ',
							`product_price` = ' . $Amount . ',
							`product_reference` = "' . $SKU . '",
							`total_price_tax_incl` = ' . $Amount * $Quantity . ',
							`total_price_tax_excl` = ' . $Item_price_excl_tax * $Quantity . ',
							`unit_price_tax_incl` = ' . $Amount . ',
							`unit_price_tax_excl` = ' . $Item_price_excl_tax . ',
							`original_product_price` = ' . $Amount . '
							';
                Db::getInstance()->Execute($sql);
                if (Pack::isPack($product_id)) {
                    $product = new Product((int) $product_id);
                    if ($product->pack_stock_type == 1 || $product->pack_stock_type == 2) {
                        $products_pack = Pack::getItems($product_id, (int) Configuration::get('PS_LANG_DEFAULT'));
                        foreach ($products_pack as $product_pack) {
                            $sql = 'UPDATE `' . $prefix . 'stock_available` set
							`quantity` = `quantity` - ' . $product_pack->pack_quantity * $Quantity . '
							where `id_product` = ' . $product_pack->id . ' and
							`id_product_attribute` = 0
									';
                            Db::getInstance()->Execute($sql);
                            $sql = 'UPDATE `' . $prefix . 'stock_available` set
									`quantity` = `quantity` - ' . $product_pack->pack_quantity * $Quantity . '
									where `id_product` = ' . $product_pack->id . ' and
									`id_product_attribute` = ' . $product_pack->id_pack_product_attribute . '
									';
                            Db::getInstance()->Execute($sql);
                        }
                    }
                    if ($product->pack_stock_type == 0 || $product->pack_stock_type == 2 || $product->pack_stock_type == 3 && (Configuration::get('PS_PACK_STOCK_TYPE') == 0 || Configuration::get('PS_PACK_STOCK_TYPE') == 2)) {
                        $sql = 'UPDATE `' . $prefix . 'stock_available` set
							`quantity` = `quantity` - ' . $Quantity . '
							where `id_product` = ' . $product_id . ' and
							`id_product_attribute` = 0
							';
                        Db::getInstance()->Execute($sql);
                        if ($product_attribute_id > 0) {
                            $sql = 'UPDATE `' . $prefix . 'stock_available` set
									`quantity` = `quantity` - ' . $Quantity . '
									where `id_product` = ' . $product_id . ' and
									`id_product_attribute` = ' . $product_attribute_id . '
									';
                            Db::getInstance()->Execute($sql);
开发者ID:ankkal,项目名称:SPN_project,代码行数:67,代码来源:NewOrderNotification.php

示例13: buildXML

    public static function buildXML()
    {
        global $country_infos;
        $context = Context::getContext();
        $country_infos = array('id_group' => 0, 'id_tax' => 1);
        $html = '<products>' . "\n";
        /* First line, columns */
        $columns = array('id', 'name', 'smallimage', 'bigimage', 'producturl', 'description', 'price', 'retailprice', 'discount', 'recommendable', 'instock');
        /* Setting parameters */
        $conf = Configuration::getMultiple(array('PS_REWRITING_SETTINGS', 'PS_LANG_DEFAULT', 'PS_SHIPPING_FREE_PRICE', 'PS_SHIPPING_HANDLING', 'PS_SHIPPING_METHOD', 'PS_SHIPPING_FREE_WEIGHT', 'PS_COUNTRY_DEFAULT', 'PS_SHOP_NAME', 'PS_CURRENCY_DEFAULT', 'PS_CARRIER_DEFAULT'));
        /* Searching for products */
        $result = Db::getInstance()->executeS('
		SELECT DISTINCT p.`id_product`, i.`id_image`
		FROM `' . _DB_PREFIX_ . 'product` p
		JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.id_product = p.id_product)
		LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (i.id_product = p.id_product)
		WHERE p.`active` = 1 AND i.id_image IS NOT NULL
		GROUP BY p.id_product');
        foreach ($result as $k => $row) {
            if (Pack::isPack(intval($row['id_product']))) {
                continue;
            }
            $product = new Product(intval($row['id_product']), true);
            if (Validate::isLoadedObject($product)) {
                $imageObj = new Image($row['id_image']);
                $imageObj->id_product = intval($product->id);
                $line = array();
                $line[] = $product->manufacturer_name . ' - ' . $product->name[intval($conf['PS_LANG_DEFAULT'])];
                $line[] = Tools::getProtocol() . $_SERVER['HTTP_HOST'] . _THEME_PROD_DIR_ . $imageObj->getExistingImgPath() . '-small.jpg';
                $line[] = Tools::getProtocol() . $_SERVER['HTTP_HOST'] . _THEME_PROD_DIR_ . $imageObj->getExistingImgPath() . '-thickbox.jpg';
                $line[] = $context->link->getProductLink(intval($product->id), $product->link_rewrite[intval($conf['PS_LANG_DEFAULT'])], $product->ean13) . '&utm_source=criteo&aff=criteo';
                $line[] = str_replace(array("\n", "\r", "\t", '|'), '', strip_tags(html_entity_decode($product->description_short[intval($conf['PS_LANG_DEFAULT'])], ENT_COMPAT, 'UTF-8')));
                $price = $product->getPrice(true, intval(Product::getDefaultAttribute($product->id)));
                $line[] = number_format($price, 2, '.', '');
                $line[] = number_format($product->getPrice(true, intval(Product::getDefaultAttribute(intval($product->id))), 6, NULL, false, false), 2, '.', '');
                $line[] = $product->getPrice(true, NULL, 2, NULL, true);
                $line[] = '1';
                $line[] = '1';
                $cptXML = 1;
                $html .= "\t" . '<product id="' . $product->id . '">' . "\n";
                foreach ($line as $column) {
                    $html .= "\t\t" . '<' . $columns[$cptXML] . '>' . $column . '</' . $columns[$cptXML] . '>' . "\n";
                    $cptXML++;
                }
                $html .= "\t" . '</product>' . "\n";
            }
        }
        $html .= '</products>' . "\n";
        echo $html;
    }
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:50,代码来源:criteo.php

示例14: foreach

     foreach ($shops as $shop) {
         if ($product->isAssociatedToShop($shop['id_shop'])) {
             $product_price = new Product($id_product_old, false, null, $shop['id_shop']);
             $product->price = $product_price->price;
         }
     }
 }
 if (Validate::isLoadedObject($product)) {
     $id_product_old = $product->id;
     for ($i = 1; $i <= $quantity; $i++) {
         echo $i;
         unset($product->id);
         unset($product->id_product);
         $product->indexed = 0;
         $product->active = 0;
         if ($product->add() && Category::duplicateProductCategories($id_product_old, $product->id) && ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false && GroupReduction::duplicateReduction($id_product_old, $product->id) && Product::duplicateAccessories($id_product_old, $product->id) && Product::duplicateFeatures($id_product_old, $product->id) && Product::duplicateSpecificPrices($id_product_old, $product->id) && Pack::duplicate($id_product_old, $product->id) && Product::duplicateCustomizationFields($id_product_old, $product->id) && Product::duplicateTags($id_product_old, $product->id) && Product::duplicateDownload($id_product_old, $product->id)) {
             if ($product->hasAttributes()) {
                 Product::updateDefaultAttribute($product->id);
             }
             if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
                 echo 'An error occurred while copying images.';
             } else {
                 Hook::exec('actionProductAdd', array('product' => $product));
                 if (in_array($product->visibility, array('both', 'search')) && Configuration::get('PS_SEARCH_INDEXATION')) {
                     Search::indexation(false, $product->id);
                 }
                 echo ' Duplication, ProductAddHook and re-index done. ';
             }
         } else {
             echo 'An error occurred while duplicating some object properties.';
         }
开发者ID:EliosIT,项目名称:PS_AchatFilet,代码行数:31,代码来源:duplication.php

示例15: getNoPackPrice

 public function getNoPackPrice()
 {
     return Pack::noPackPrice($this->id);
 }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:4,代码来源:Product.php


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