Ignore:
Timestamp:
2009/11/20 10:45:14 (14 years ago)
Author:
kajiwara
Message:

#524 商品一覧で、複数のカテゴリに割り当てたれた商品の並び順が不正となる 不具合を修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_4/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php

    r17939 r18388  
    272272     */ 
    273273    function viewToSubQuery() { 
     274        $sql['vw_products_allclass_detail'] =<<< __EOS__ 
     275            ( 
     276                SELECT 
     277                    dtb_products.product_id, 
     278                    dtb_products.name, 
     279                    dtb_products.deliv_fee, 
     280                    dtb_products.sale_limit, 
     281                    dtb_products.sale_unlimited, 
     282                    dtb_products.rank, 
     283                    dtb_products.status, 
     284                    dtb_products.product_flag, 
     285                    dtb_products.point_rate, 
     286                    dtb_products.comment1, 
     287                    dtb_products.comment2, 
     288                    dtb_products.comment3, 
     289                    dtb_products.comment4, 
     290                    dtb_products.comment5, 
     291                    dtb_products.comment6, 
     292                    dtb_products.note, 
     293                    dtb_products.file1, 
     294                    dtb_products.file2, 
     295                    dtb_products.file3, 
     296                    dtb_products.file4, 
     297                    dtb_products.file5, 
     298                    dtb_products.file6, 
     299                    dtb_products.main_list_comment, 
     300                    dtb_products.main_list_image, 
     301                    dtb_products.main_comment, 
     302                    dtb_products.main_image, 
     303                    dtb_products.main_large_image, 
     304                    dtb_products.sub_title1, 
     305                    dtb_products.sub_comment1, 
     306                    dtb_products.sub_image1, 
     307                    dtb_products.sub_large_image1, 
     308                    dtb_products.sub_title2, 
     309                    dtb_products.sub_comment2, 
     310                    dtb_products.sub_image2, 
     311                    dtb_products.sub_large_image2, 
     312                    dtb_products.sub_title3, 
     313                    dtb_products.sub_comment3, 
     314                    dtb_products.sub_image3, 
     315                    dtb_products.sub_large_image3, 
     316                    dtb_products.sub_title4, 
     317                    dtb_products.sub_comment4, 
     318                    dtb_products.sub_image4, 
     319                    dtb_products.sub_large_image4, 
     320                    dtb_products.sub_title5, 
     321                    dtb_products.sub_comment5, 
     322                    dtb_products.sub_image5, 
     323                    dtb_products.sub_large_image5, 
     324                    dtb_products.sub_title6, 
     325                    dtb_products.sub_comment6, 
     326                    dtb_products.sub_image6, 
     327                    dtb_products.sub_large_image6, 
     328                    dtb_products.del_flg, 
     329                    dtb_products.creator_id, 
     330                    dtb_products.create_date, 
     331                    dtb_products.update_date, 
     332                    dtb_products.deliv_date_id, 
     333                    T4.product_code_min, 
     334                    T4.product_code_max, 
     335                    T4.price01_min, 
     336                    T4.price01_max, 
     337                    T4.price02_min, 
     338                    T4.price02_max, 
     339                    T4.stock_min, 
     340                    T4.stock_max, 
     341                    T4.stock_unlimited_min, 
     342                    T4.stock_unlimited_max, 
     343                    T4.class_count 
     344                FROM 
     345                    dtb_products 
     346                    LEFT JOIN 
     347                        ( 
     348                            SELECT 
     349                                product_id, 
     350                                MIN(product_code) AS product_code_min, 
     351                                MAX(product_code) AS product_code_max, 
     352                                MIN(price01) AS price01_min, 
     353                                MAX(price01) AS price01_max, 
     354                                MIN(price02) AS price02_min, 
     355                                MAX(price02) AS price02_max, 
     356                                MIN(stock) AS stock_min, 
     357                                MAX(stock) AS stock_max, 
     358                                MIN(stock_unlimited) AS stock_unlimited_min, 
     359                                MAX(stock_unlimited) AS stock_unlimited_max, 
     360                                COUNT(*) as class_count 
     361                            FROM dtb_products_class 
     362                            GROUP BY product_id 
     363                        ) AS T4 
     364                        ON dtb_products.product_id = T4.product_id 
     365            ) 
     366__EOS__; 
     367 
    274368        return array( 
    275369            "vw_cross_class" => ' 
     
    365459                ON T1.product_id = T2.product_id_sub) ', 
    366460 
    367         "vw_products_allclass" => ' 
    368                (SELECT 
    369                     T2.product_id 
    370                     ,T1.product_code_min 
    371                     ,T1.product_code_max 
    372                     ,T1.price01_min 
    373                     ,T1.price01_max 
    374                     ,T1.price02_min 
    375                     ,T1.price02_max 
    376                     ,T1.stock_min 
    377                     ,T1.stock_max 
    378                     ,T1.stock_unlimited_min 
    379                     ,T1.stock_unlimited_max 
    380                     ,T2.del_flg 
    381                     ,T2.status 
    382                     ,T2.name 
    383                     ,T2.comment1 
    384                     ,T2.comment2 
    385                     ,T2.comment3 
    386                     ,T2.main_list_comment 
    387                     ,T2.main_image 
    388                     ,T2.main_list_image 
    389                     ,T2.product_flag 
    390                     ,T2.deliv_date_id 
    391                     ,T2.sale_limit 
    392                     ,T2.point_rate 
    393                     ,T2.sale_unlimited 
    394                     ,T2.create_date 
    395                     ,T2.deliv_fee 
    396                     ,T3.rank 
    397                     ,T4.rank AS category_rank 
    398                     ,T4.category_id 
     461            "vw_products_allclass" => " 
     462            ( 
     463                SELECT 
     464                    alldtl.*, 
     465                    dtb_category.rank AS category_rank, 
     466                    T2.category_id, 
     467                    T2.rank AS product_rank 
    399468                FROM 
    400                     ( 
    401                         (dtb_products AS T2 RIGHT JOIN 
    402                             (SELECT 
    403                                 product_id AS product_id_sub 
    404                                 ,MIN(product_code) AS product_code_min 
    405                                 ,MAX(product_code) AS product_code_max 
    406                                 ,MIN(price01) AS price01_min 
    407                                 ,MAX(price01) AS price01_max 
    408                                 ,MIN(price02) AS price02_min 
    409                                 ,MAX(price02) AS price02_max 
    410                                 ,MIN(stock) AS stock_min 
    411                                 ,MAX(stock) AS stock_max 
    412                                 ,MIN(stock_unlimited) AS stock_unlimited_min 
    413                                 ,MAX(stock_unlimited) AS stock_unlimited_max 
    414                             FROM dtb_products_class GROUP BY product_id 
    415                             ) AS T1 ON T1.product_id_sub = T2.product_id 
    416                         ) LEFT JOIN dtb_product_categories AS T3 ON T2.product_id = T3.product_id 
    417                     ) LEFT JOIN dtb_category AS T4 ON T3.category_id = T4.category_id 
    418                 ) ', 
    419  
    420             "vw_products_allclass_detail" => ' 
    421                 (SELECT product_id,price01_min,price01_max,price02_min,price02_max,stock_min,stock_max,stock_unlimited_min,stock_unlimited_max, 
    422                 del_flg,status,name,comment1,comment2,comment3,deliv_fee,main_comment,main_image,main_large_image, 
    423                 sub_title1,sub_comment1,sub_image1,sub_large_image1, 
    424                 sub_title2,sub_comment2,sub_image2,sub_large_image2, 
    425                 sub_title3,sub_comment3,sub_image3,sub_large_image3, 
    426                 sub_title4,sub_comment4,sub_image4,sub_large_image4, 
    427                 sub_title5,sub_comment5,sub_image5,sub_large_image5, 
    428                 product_flag,deliv_date_id,sale_limit,point_rate,sale_unlimited,file1,file2,category_id 
    429                 FROM ( SELECT * FROM (dtb_products AS T1 RIGHT JOIN 
    430                 (SELECT 
    431                 product_id AS product_id_sub, 
    432                 MIN(price01) AS price01_min, 
    433                 MAX(price01) AS price01_max, 
    434                 MIN(price02) AS price02_min, 
    435                 MAX(price02) AS price02_max, 
    436                 MIN(stock) AS stock_min, 
    437                 MAX(stock) AS stock_max, 
    438                 MIN(stock_unlimited) AS stock_unlimited_min, 
    439                 MAX(stock_unlimited) AS stock_unlimited_max 
    440                 FROM dtb_products_class GROUP BY product_id) AS T2 
    441                 ON T1.product_id = T2.product_id_sub ) ) AS T3 LEFT JOIN (SELECT rank AS category_rank, category_id AS sub_category_id FROM dtb_category) AS T4 
    442                 ON T3.category_id = T4.sub_category_id) ', 
     469                    {$sql['vw_products_allclass_detail']} AS alldtl 
     470                    LEFT JOIN 
     471                        dtb_product_categories AS T2 
     472                        ON alldtl.product_id = T2.product_id 
     473                    LEFT JOIN 
     474                        dtb_category 
     475                        ON T2.category_id = dtb_category.category_id 
     476            ) ", 
     477 
     478            "vw_products_allclass_detail" => $sql['vw_products_allclass_detail'], 
    443479 
    444480            "vw_product_class" => ' 
Note: See TracChangeset for help on using the changeset viewer.