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


PHP product::permalink方法代码示例

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


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

示例1: put

 /**
  * 提交
  */
 public function put()
 {
     $request_data = $this->input->post();
     $total_products = 0;
     $total = 0;
     if (empty($request_data['order_id']) || !is_numeric($request_data['order_id'])) {
         remind::set(Kohana::lang('o_global.bad_request'), request::referrer());
     }
     $order = Myorder::instance($request_data['order_id'])->get();
     if (empty($order) || !isset($order)) {
         remind::set(Kohana::lang('o_global.bad_request'), request::referrer());
     }
     $good_ids = $request_data['good_id'];
     $prices = $request_data['discount_price'];
     $amounts = $request_data['amount'];
     if ($good_ids && is_array($good_ids)) {
         foreach ($good_ids as $key => $val) {
             $good_full_data = ProductService::get_instance()->get($val);
             if (empty($good_full_data) || !isset($good_full_data)) {
                 remind::set(Kohana::lang('o_global.bad_request'), request::referrer());
             }
             if ($good_full_data['store'] == '0') {
                 remind::set(Kohana::lang('o_global.bad_request'), request::referrer());
             }
             //得到合理的价格数值
             if ($good_full_data['store'] == -1 && $amounts[$key] > 999) {
                 $amounts[$key] = 999;
             }
             if ($good_full_data['store'] != -1 && $amounts[$key] > $good_full_data['store']) {
                 $amounts[$key] = $good_full_data['store'];
             }
             //$product_data = ProductService::get_instance()->get($good_full_data['product_id']);
             $order_product_detail_data = array();
             $order_product_detail_data['order_id'] = $order['id'];
             $order_product_detail_data['product_type'] = ProductService::PRODUCT_TYPE_GOODS;
             $order_product_detail_data['dly_status'] = 'storage';
             //$order_product_detail_data['product_id']            = $product_data['id'];
             $order_product_detail_data['good_id'] = $val;
             $order_product_detail_data['quantity'] = $amounts[$key];
             $order_product_detail_data['sendnum'] = '0';
             $order_product_detail_data['price'] = $good_full_data['price'];
             $order_product_detail_data['discount_price'] = $prices[$key];
             $order_product_detail_data['weight'] = $good_full_data['weight'];
             $order_product_detail_data['name'] = $good_full_data['title'];
             $order_product_detail_data['SKU'] = $good_full_data['sku'];
             $order_product_detail_data['brief'] = $good_full_data['brief'];
             $order_product_detail_data['date_add'] = date('Y-m-d H:i:s', time());
             $order_product_detail_data['link'] = product::permalink($good_full_data);
             order::do_order_product_detail_data_by_good(&$order_product_detail_data, $good_full_data, $good_full_data['default_image_id']);
             Myorder_product::instance()->add($order_product_detail_data);
         }
         //重新查询数据库,计算价格
         $goods_order = Myorder_product::instance()->order_product_details(array('order_id' => $order['id']));
         foreach ($goods_order as $val) {
             $total_products += $val['quantity'] * $val['discount_price'];
         }
         $total = $total_products + $order['total_shipping'];
         $total_real = round($total * 100 / $order['conversion_rate']) / 100;
         $final_data = array('total' => $total, 'total_products' => $total_products, 'total_real' => $total_real);
         if (Myorder::instance($order['id'])->edit($final_data)) {
             remind::set(Kohana::lang('o_global.add_success'), '', 'success');
         } else {
             remind::set(Kohana::lang('o_global.add_error'), '', 'error');
         }
     } else {
         remind::set(Kohana::lang('o_global.add_error'), '', 'error');
     }
     $this->template = new View('layout/commonfix_html');
     $this->template->content = new View("order/order_product/put_goods");
     $this->template->content->order = $order;
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:74,代码来源:order_product.php

示例2: do_add


//.........这里部分代码省略.........
         $user_id = $this->input->post('user_id');
         $email = $this->input->post('email');
         $carrier = $this->input->post('carrier');
         $currency_code = $this->input->post('code');
         if ($user_id && $email && $currency_code) {
             /* 订单用户信息*/
             $order_data['user_id'] = $user_id;
             $order_data['email'] = $email;
             /* 订单币种信息*/
             $currency = Mycurrency::instance()->get_by_code($currency_code);
             $order_data['currency'] = $currency_code;
             $order_data['conversion_rate'] = $currency['conversion_rate'];
             /* 订单国家*/
             $order_data['shipping_country'] = Mycountry::instance($post->shipping_country)->get('iso_code');
             $order_data['billing_country'] = Mycountry::instance($post->billing_country)->get('iso_code');
             /* 订单时间和IP信息*/
             $order_data['data_add'] = date('Y-m-d H:i:s', time());
             $order_data['IP'] = tool::get_long_ip();
             /* 订单号生成*/
             $order_num = '';
             do {
                 $temp = sprintf("%14.0f", date('ymd') . "00000" + rand(0, 99999) . "0000");
                 $exist_data = array();
                 $exist_data['order_num'] = $temp;
                 if (!Myorder::instance()->exist($exist_data)) {
                     $order_num = $temp;
                     break;
                 }
             } while (1);
             $order_data['order_num'] = $order_num;
             $order_data['order_status'] = '1';
             $order_data['pay_status'] = '1';
             $order_data['ship_status'] = '1';
             $order_data['user_status'] = 'NULL';
             $order_data['order_source'] = 'manual';
             $order_data['total'] = $post->good_price + $post->shipping_price;
             $order_data['total_products'] = $post->good_price;
             $order_data['total_shipping'] = $post->shipping_price;
             $order_data['total_real'] = $order_data['total'] / $order_data['conversion_rate'];
             $order_data['total_discount'] = '0.00';
             $order_data['total_paid'] = '0.00';
             $order_data['shipping_firstname'] = $post->shipping_firstname;
             $order_data['shipping_lastname'] = $post->shipping_lastname;
             $order_data['shipping_state'] = $post->shipping_state;
             $order_data['shipping_city'] = $post->shipping_city;
             $order_data['shipping_address'] = $post->shipping_address;
             $order_data['shipping_zip'] = $post->shipping_zip;
             $order_data['shipping_phone'] = $post->shipping_phone;
             $order_data['shipping_mobile'] = $post->shipping_mobile;
             $order_data['billing_firstname'] = $post->billing_firstname;
             $order_data['billing_lastname'] = $post->billing_lastname;
             $order_data['billing_state'] = $post->billing_state;
             $order_data['billing_city'] = $post->billing_city;
             $order_data['billing_address'] = $post->billing_address;
             $order_data['billing_zip'] = $post->billing_zip;
             $order_data['billing_phone'] = $post->billing_phone;
             $order_data['billing_mobile'] = $post->billing_mobile;
             $order_data['carrier'] = $carrier;
             $order_data['active'] = 1;
         } else {
             remind::set(Kohana::lang('o_order.data_trans_wrong'), 'order/order_add', 'error');
         }
         /* 添加订单,返回订单数据*/
         $order_id = Myorder::instance()->add($order_data);
         $order = Myorder::instance($order_id)->get();
         /* 添加订单产品信息*/
         $session = Session::instance();
         $cart_data = $session->get('cart_data');
         if (isset($cart_data) && is_array($cart_data) && count($cart_data) && !empty($order['order_num'])) {
             foreach ($cart_data as $key => $rs) {
                 $good_full_data = ProductService::get_instance()->get($key);
                 $order_product_detail_data = array();
                 $order_product_detail_data['order_id'] = $order['id'];
                 $order_product_detail_data['product_type'] = ProductService::PRODUCT_TYPE_GOODS;
                 $order_product_detail_data['dly_status'] = 'storage';
                 //$order_product_detail_data['product_id']            = $good_full_data['product_id'];
                 $order_product_detail_data['good_id'] = $key;
                 $order_product_detail_data['quantity'] = $rs;
                 $order_product_detail_data['sendnum'] = '0';
                 $order_product_detail_data['price'] = $good_full_data['price'];
                 $order_product_detail_data['discount_price'] = $good_full_data['price'];
                 $order_product_detail_data['weight'] = $good_full_data['weight'];
                 //$order_product_detail_data['name']                = $good_full_data['name_manage'];
                 $order_product_detail_data['name'] = $good_full_data['title'];
                 $order_product_detail_data['SKU'] = $good_full_data['sku'];
                 $order_product_detail_data['brief'] = $good_full_data['brief'];
                 $order_product_detail_data['date_add'] = date('Y-m-d H:i:s', time());
                 $order_product_detail_data['link'] = product::permalink($good_full_data);
                 order::do_order_product_detail_data_by_good(&$order_product_detail_data, $good_full_data, $good_full_data['default_image_id']);
                 $order_product_detail = Myorder_product::instance()->add($order_product_detail_data);
             }
         }
         /*验证是否添加成功,添加成功返回订单号*/
         if (!empty($order['order_num']) && $order_product_detail) {
             remind::set(Kohana::lang('o_order.add_order_success') . $order['order_num'], 'order/order', 'success');
         } else {
             remind::set(Kohana::lang('o_order.add_order_wrong'), 'order/order_add', 'error');
         }
     }
 }
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:101,代码来源:order_add.php

示例3:

            echo $rs['id'];
            ?>
" class="act_dorecycle"> 还原</a>
                            <a href="<?php 
            echo url::base();
            ?>
product/product/delete?status=2&id=<?php 
            echo $rs['id'];
            ?>
" class="act_dodelete"> 永久删除</a>
                            <?php 
        } else {
            ?>
            
                            <a href="<?php 
            echo product::permalink($rs);
            ?>
" target="_blank">查看</a>
                            <a class="act_doedit" href="<?php 
            echo url::base();
            ?>
product/product/edit?id=<?php 
            echo $rs['id'];
            ?>
">编辑</a>
                            <a href="<?php 
            echo url::base();
            ?>
product/product/delete?id=<?php 
            echo $rs['id'];
            ?>
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:31,代码来源:index.php

示例4: build

 public function build()
 {
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         //$profiler = new Profiler;
         //* 初始化返回数据 */
         $return_data = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $request_data = $this->input->post();
         //* 实现功能后屏蔽此异常抛出 */
         //throw new MyRuntimeException('Not Implemented',501);
         //权限验证
         if ($this->site_id == 0) {
             throw new MyRuntimeException(Kohana::lang('o_global.select_site'), 400);
         }
         role::check('default', $this->site_id, 0);
         // 调用底层服务
         $sitemap_service = SitemapService::get_instance();
         //业务逻辑
         $xmlContent = '';
         $xmlContent .= '<?xml version="1.0" encoding="UTF-8"?>';
         $xmlContent .= '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
         //添加首页
         if (!empty($request_data['index']) && is_numeric($request_data['index'])) {
             $priority = number_format($request_data['index'], 1);
         } else {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 404);
         }
         $site_domain = Mysite::instance($this->site_id)->get('domain');
         $xmlContent .= sitemap::Render('http://' . $site_domain, 0, 'always', $priority);
         //添加分类页面
         $categories = $sitemap_service->get_category_page_by_site_id($this->site_id);
         if (!empty($request_data['category']) && is_numeric($request_data['category'])) {
             $priority = number_format($request_data['category'], 1);
         } else {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 404);
         }
         if (!empty($categories)) {
             foreach ($categories as $category) {
                 if (empty($request_data['exclude_category']) || !empty($request_data['exclude_category']) && !in_array($category['id'], $request_data['exclude_category'])) {
                     $xmlContent .= sitemap::Render(category::permalink($category['id']), 0, 'weekly', $priority);
                 }
             }
         }
         //添加商品页面
         if (!empty($request_data['product']) && is_numeric($request_data['product'])) {
             $priority = number_format($request_data['product'], 1);
         } else {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 404);
         }
         if (isset($request_data['on_sale'])) {
             $on_sale = intval($request_data['on_sale']);
         } else {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 404);
         }
         $products = $sitemap_service->get_product_page_by_site_id($this->site_id, $on_sale);
         if (!empty($request_data['exclude_product'])) {
             if (preg_match('/^([a-zA-Z0-9_]+,)*[a-zA-Z0-9_]+$/i', $request_data['exclude_product'])) {
                 $request_data['exclude_product'] = explode(',', $request_data['exclude_product']);
             } else {
                 throw new MyRuntimeException(Kohana::lang('o_site.product_id_format_check'), 404);
             }
         }
         if (!empty($products)) {
             foreach ($products as $product) {
                 if (empty($request_data['exclude_product'])) {
                     $xmlContent .= sitemap::Render(product::permalink($product['id']), $product['update_timestamp'], 'weekly', $priority);
                 } elseif (!empty($request_data['exclude_product']) && !in_array($product['sku'], $request_data['exclude_product'])) {
                     $xmlContent .= sitemap::Render(product::permalink($product['id']), $product['update_timestamp'], 'weekly', $priority);
                 }
             }
         }
         //添加促销页
         if (!empty($request_data['promotion']) && is_numeric($request_data['promotion'])) {
             $priority = number_format($request_data['promotion'], 1);
         } else {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 404);
         }
         $promotions = $sitemap_service->get_promotion_page_by_site_id($this->site_id);
         if (!empty($promotions)) {
             $route = Myroute::instance()->get();
             $action = $route['promotion'];
             foreach ($promotions as $promotion) {
                 $xmlContent .= sitemap::Render('http://' . $site_domain . '/' . $action . '/' . $promotion['id'], time(), 'weekly', $priority);
             }
         }
         //添加文案页
         if (!empty($request_data['doc']) && is_numeric($request_data['doc'])) {
             $priority = number_format($request_data['doc'], 1);
         } else {
             throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 404);
         }
         $docs = $sitemap_service->get_doc_page_by_site_id($this->site_id);
         if (!empty($docs)) {
             foreach ($docs as $doc) {
                 $lastmod = strtotime($doc['updated']);
                 $xmlContent .= sitemap::Render('http://' . $site_domain . '/' . $doc['permalink'], $lastmod, 'weekly', $priority);
             }
         }
         $xmlContent .= '</urlset>';
//.........这里部分代码省略.........
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:101,代码来源:sitemap.php

示例5:

    $order_product = coding::decode_product($order_product);
    ?>
                    <tr>
                        <td>
                        <?php 
    if (!empty($order_product['link'])) {
        ?>
                        <a href="<?php 
        echo $order_product['link'];
        ?>
" target="_blank">
                        <?php 
    } else {
        ?>
                        <a href="<?php 
        echo product::permalink($order_product);
        ?>
" target="_blank">
                        <?php 
    }
    ?>
                        <?php 
    echo $order_product['name'];
    if ($order_product['attribute_style']) {
        echo '(' . $order_product['attribute_style'] . ')';
    }
    ?>
                        </a>
                        </td>
                        <td><?php 
    echo $order_product['remark'];
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:31,代码来源:order_edit.php


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