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


PHP Formatter::generateSeoURL方法代码示例

本文整理汇总了PHP中Formatter::generateSeoURL方法的典型用法代码示例。如果您正苦于以下问题:PHP Formatter::generateSeoURL方法的具体用法?PHP Formatter::generateSeoURL怎么用?PHP Formatter::generateSeoURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Formatter的用法示例。


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

示例1: saveBlog

 public function saveBlog($store_id, $input, $blog_id = 0)
 {
     if (!$blog_id) {
         $this->query("INSERT INTO PREFIX_blog SET create_time = :date", array('date' => date('Y-m-d H:i:s')));
         $blog_id = $this->lastInsertId();
     }
     $this->query("UPDATE PREFIX_blog\n            SET store_id    = :store,\n                author      = :author,\n                update_time = :update,\n                publish_date= :publish\n            WHERE blog_id   = :id", array('store' => $store_id, 'author' => $input['author'], 'update' => date('Y-m-d H:i:s'), 'publish' => date('Y-m-d H:i:s', strtotime($input['publish_date'])), 'id' => $blog_id));
     $this->query("DELETE FROM PREFIX_blog_description WHERE blog_id = :id", array('id' => $blog_id));
     $this->query("DELETE FROM PREFIX_url_alias WHERE query = :query", array('query' => 'blog_id=' . $blog_id));
     foreach ($input['description'] as $lang => $list) {
         $this->query("INSERT INTO PREFIX_blog_description\n                SET language_id     = :lang,\n                    title           = :title,\n                    intro_text      = :intro,\n                    text            = :text,\n                    meta_description= :meta,\n                    meta_keyword    = :keys,\n                    blog_id  = :id", array('id' => $blog_id, 'lang' => $lang, 'title' => $list['title'], 'intro' => $list['intro_text'], 'text' => $list['text'], 'meta' => $list['meta_description'], 'keys' => $list['meta_keyword']));
         Formatter::generateSeoURL($list['title'], 'blog_id', $blog_id, $lang, $store_id);
     }
     Cache::removeAll();
     return $blog_id;
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:16,代码来源:cms.php

示例2: editProduct

 public function editProduct($product_id, $data)
 {
     // stock & quantity
     if (isset($data['stock_product']) && !$data['stock_product'] || $data['stock_id'] == $product_id) {
         $data['stock_id'] = $product_id;
         $data['product_quantity'] = (int) $data['product_quantity'];
         if (!isset($data['stock_status_id'])) {
             $data['stock_status_id'] = 1;
         }
         $data['stock_status_id'] = (int) $data['stock_status_id'];
     } else {
         // Existing product as stock_id?
         $query = $this->query('SELECT product_id FROM PREFIX_product WHERE product_id = ' . (int) $data['stock_id'])->fetch();
         if ($query['product_id'] > 0) {
             $data['product_quantity'] = 'p2.quantity';
             $data['stock_status_id'] = 'p2.stock_status_id';
         } else {
             $data['stock_status_id'] = 1;
             $data['stock_id'] = $product_id;
             $data['product_quantity'] = (int) $data['product_quantity'];
         }
     }
     $data['product_price'] = str_replace(',', '.', $data['product_price']);
     $data['cost_price'] = str_replace(',', '.', $data['cost_price']);
     $this->query("UPDATE PREFIX_product\n            SET stock_id = :stock\n            WHERE product_id = :pid", array('stock' => $data['stock_id'], 'pid' => $product_id));
     $this->query("UPDATE PREFIX_product AS p\n            INNER JOIN PREFIX_product AS p2\n                ON p.stock_id = p2.product_id\n            SET p.model_2           = :model,\n                p.model_supplier    = :model_supplier,\n                p.location          = :location,\n                p.minimum           = :minimum,\n                p.subtract          = :subtract,\n                p.quantity          = :quantity,\n                p.stock_status_id   = :stock_status_id,\n                p.stock_id          = :stock_id,\n                p.stock_visible     = :stock_visible,\n                p.date_available    = :date_available,\n                p.manufacturer_id   = :manufacturer_id,\n                p.shipping          = :shipping,\n                p.price             = :price,\n                p.cost_price        = :cost_price,\n                p.points            = :points,\n                p.weight            = :weight,\n                p.weight_class_id   = :wclass_id,\n                p.length            = :length,\n                p.width             = :width,\n                p.height            = :height,\n                p.length_class_id   = :lclass_id,\n                p.status            = :status,\n                p.tax_percentage    = :tax_percentage,\n                p.date_modified     = :modified\n            WHERE p.product_id      = :product_id", array('model' => $data['model_2'], 'model_supplier' => $data['model_supplier'], 'location' => $data['location'], 'minimum' => $data['minimum'], 'subtract' => $data['subract'], 'quantity' => $data['product_quantity'], 'stock_status_id' => $data['stock_status_id'], 'stock_id' => $data['stock_id'], 'stock_visible' => $data['stock_visible'], 'date_available' => Formatter::dateReverse($data['date_available']), 'manufacturer_id' => $data['manufacturer_id'], 'shipping' => $data['shipping'], 'price' => $data['product_price'], 'cost_price' => $data['cost_price'], 'points' => $data['product_points'], 'weight' => $data['product_weight'], 'wclass_id' => $data['weight_class_id'], 'length' => $data['length'], 'lclass_id' => $data['length_class_id'], 'height' => $data['height'], 'width' => $data['width'], 'status' => $data['status'], 'tax_percentage' => $data['tax_percentage'], 'modified' => date('Y-m-d H:i:s'), 'product_id' => $product_id));
     $info_types = array('sku', 'upc', 'ean', 'jan', 'isbn', 'mpn');
     foreach ($info_types as $type) {
         if (isset($data[$type])) {
             if (!isset($data[$type . '_visible'])) {
                 $data[$type . '_visible'] = 0;
             }
             $this->query("\n                    UPDATE PREFIX_product\n                    SET " . $type . " = :var,\n                        " . $type . "_visible = " . (int) $data[$type . '_visible'] . "\n                    WHERE product_id = :pid", array('pid' => $product_id, 'var' => !empty($data[$type]) ? $data[$type] : ''));
         }
     }
     if (!isset($data['sort_order'])) {
         $sort_order = 0;
         // Get highest sort order for all categories
         foreach ($data['product_category'] as $k => $category_id) {
             $row = $this->query("\n                    SELECT MAX(sort_order) AS sort_order\n                    FROM PREFIX_product p\n                    LEFT JOIN PREFIX_product_to_category AS ptc\n                        ON ptc.product_id = p.product_id\n                    WHERE ptc.category_id = " . $category_id)->fetch();
             if ($row['sort_order'] > $sort_order) {
                 $sort_order = $row['sort_order'];
             }
         }
         $this->query("\n                UPDATE PREFIX_product\n                SET sort_order = " . (int) ($sort_order + 1) . "\n                WHERE product_id = " . (int) $product_id);
     }
     // Delete existing url-aliases (this may cause SEO-issues, investigate that a bit...)
     $this->query("DELETE FROM PREFIX_url_alias WHERE `query` = 'product_id=" . $product_id . "'");
     $this->query("DELETE FROM PREFIX_product_description WHERE product_id = " . (int) $product_id);
     foreach ($data['product_description'] as $language_id => $value) {
         unset($value['keyword']);
         $value['product_id'] = $product_id;
         $value['language_id'] = $language_id;
         $this->query("\n                INSERT INTO PREFIX_product_description\n                SET product_id      = :product_id,\n                    language_id     = :language_id,\n                    name            = :name,\n                    title           = :title,\n                    meta_keyword    = :meta_keyword,\n                    meta_description = :meta_description,\n                    description     = :description,\n                    tag             = :tag", $value);
         foreach (array_unique($data['product_category']) as $category_id) {
             foreach (array_unique($data['product_store']) as $store_id) {
                 Formatter::generateSeoURL($value['name'], 'product_id', $product_id, $language_id, $store_id, $category_id);
             }
         }
     }
     $this->query("DELETE FROM PREFIX_product_to_store WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_product_to_category WHERE product_id = " . (int) $product_id);
     foreach (array_unique($data['product_category']) as $category_id) {
         $this->query("\n                INSERT INTO PREFIX_product_to_category\n                SET product_id  = " . (int) $product_id . ",\n                    category_id = " . (int) $category_id);
     }
     foreach (array_unique($data['product_store']) as $store_id) {
         $this->query("\n                INSERT INTO PREFIX_product_to_store\n                SET product_id  = " . (int) $product_id . ",\n                    store_id    = " . (int) $store_id);
     }
     $this->query("DELETE FROM PREFIX_product_attribute WHERE product_id = " . (int) $product_id);
     if (!empty($data['attribute']) && is_array($data['attribute'])) {
         $this->load->model('catalog/attribute');
         foreach ($data['attribute'] as $attributeID) {
             // Get attribute info
             $attributeInfo = $this->model_catalog_attribute->getAttributeDescriptions($attributeID);
             if (!empty($attributeInfo) && is_array($attributeInfo)) {
                 foreach ($attributeInfo as $languageID => $attributeDescription) {
                     $this->query("\n                            INSERT INTO PREFIX_product_attribute\n                            SET product_id  = " . (int) $product_id . ",\n                                attribute_id    = " . (int) $attributeID . ",\n                                language_id     = " . (int) $languageID . ",\n                                text            = :text", array('text' => $attributeDescription['name']));
                 }
             }
         }
     }
     $this->query("DELETE FROM PREFIX_product_option_value_description WHERE value_id IN (SELECT value_id FROM PREFIX_product_option_value WHERE option_id IN (SELECT option_id FROM PREFIX_product_option WHERE product_id = " . (int) $product_id . "))");
     $this->query("DELETE FROM PREFIX_product_option_value WHERE option_id IN (SELECT option_id FROM PREFIX_product_option WHERE product_id = " . (int) $product_id . ")");
     $this->query("DELETE FROM PREFIX_product_option_description WHERE option_id IN (SELECT option_id FROM PREFIX_product_option WHERE product_id = " . (int) $product_id . ")");
     $this->query("DELETE FROM PREFIX_product_option WHERE product_id = " . (int) $product_id);
     if (isset($data['product_option'])) {
         foreach ($data['product_option'] as $productOption) {
             if (!empty($productOption['option_description'][$this->config->get('language_id')]['name'])) {
                 $this->query("INSERT INTO PREFIX_product_option SET\n                        product_id = :productID,\n                        type = :type,\n                        sort_order = 0", array('productID' => $product_id, 'type' => $productOption['type']));
                 $optionID = $this->lastInsertId();
                 // Insert translations
                 foreach ($productOption['option_description'] as $languageID => $productOptionDescription) {
                     $this->query("INSERT INTO PREFIX_product_option_description SET\n                            option_id = :optionID,\n                            language_id = :languageID,\n                            name = :name", array('optionID' => $optionID, 'languageID' => $languageID, 'name' => $productOptionDescription['name']));
                 }
                 // Insert values (if applicable)
                 if (in_array($productOption['type'], array('select', 'radio', 'checkbox')) && isset($productOption['product_option_value'])) {
                     foreach ($productOption['product_option_value'] as $productOptionValue) {
                         if (!empty($productOptionValue['option_value_description'][$this->config->get('language_id')]['name'])) {
                             // We want to store the price excluding the tax. Why? The Dutch government likes to change tax
                             // rates. So! Store as ex-tax, show as inc-tax.
//.........这里部分代码省略.........
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:101,代码来源:product.php


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