Changeset 4471
- Timestamp:
- 06/18/12 09:03:10 (12 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/catalog/admin/includes/modules/pages/products.php
r4433 r4471 25 25 26 26 /** 27 @def FILENAME current page 27 @def FILENAME current page 28 28 */ 29 29 const FILENAME = FILENAME_PRODUCTS; 30 30 /** 31 @var int current id 31 @var int current id 32 32 */ 33 33 public static $Id; … … 174 174 */ 175 175 self::$allfields = array( 176 'p.products_id' => array( 177 'sort'=>true, 178 'alias'=>'id', 176 'p.products_id' => array( 177 'sort'=>true, 178 'alias'=>'id', 179 179 'text'=>__('products table heading id'), 180 'width'=>'2%', 180 'width'=>'2%', 181 181 'class'=>'tcenter', 182 182 'default'=>true, 183 ), 184 'p.products_image' => array( 185 'sort'=>true, 186 'alias'=>'image', 183 ), 184 'p.products_image' => array( 185 'sort'=>true, 186 'alias'=>'image', 187 187 'text'=>__('products table heading image'), 188 ), 189 'pd.products_name' => array( 190 'sort'=>true, 191 'alias'=>'title', 188 ), 189 'pd.products_name' => array( 190 'sort'=>true, 191 'alias'=>'title', 192 192 'text'=>__('products table heading name'), 193 193 'default'=>true, 194 'width'=>'18%', 195 ), 196 'p.products_model' => array( 197 'sort'=>true, 198 'alias'=>'model', 194 'width'=>'18%', 195 ), 196 'p.products_model' => array( 197 'sort'=>true, 198 'alias'=>'model', 199 199 'text'=>__('products table heading modele'), 200 ), 200 ), 201 201 ); 202 202 /* DEB Datatype RootListing categorie */ 203 203 if( DataTypes::is_active('categorie')) { 204 self::$allfields['cat.categories_id']= array( 205 'sort'=>true, 206 'alias'=>'categories_id', 204 self::$allfields['cat.categories_id']= array( 205 'sort'=>true, 206 'alias'=>'categories_id', 207 207 'text'=>__('products table heading categories id'), 208 'width'=>'6%', 209 ); 210 self::$allfields['catd.categories_name']= array( 211 'sort'=>true, 212 'alias'=>'cat_title', 208 'width'=>'6%', 209 ); 210 self::$allfields['catd.categories_name']= array( 211 'sort'=>true, 212 'alias'=>'cat_title', 213 213 'text'=>__('products table heading categories'), 214 'width'=>'12%', 214 'width'=>'12%', 215 215 'default'=>true, 216 216 ); … … 220 220 /* DEB Datatype RootListing manufacturer */ 221 221 if( DataTypes::is_active('manufacturer')) { 222 self::$allfields['p.manufacturers_id']= array( 223 'sort'=>true, 224 'alias'=>'manufacturers_id', 222 self::$allfields['p.manufacturers_id']= array( 223 'sort'=>true, 224 'alias'=>'manufacturers_id', 225 225 'text'=>__('products table heading manufacturers id'), 226 ); 227 self::$allfields['m.manufacturers_name']= array( 228 'sort'=>true, 229 'alias'=>'manuf_title', 226 ); 227 self::$allfields['m.manufacturers_name']= array( 228 'sort'=>true, 229 'alias'=>'manuf_title', 230 230 'text'=>__('products table heading manufacturers'), 231 'width'=>'12%', 232 ); 231 'width'=>'12%', 232 ); 233 233 } 234 234 /* END Datatype RootListing manufacturer */ … … 237 237 /* DEB Datatype RootListing featured */ 238 238 if( DataTypes::is_active('featured')) { 239 self::$allfields['fada.featured_id']= array( 240 'sort'=>true, 241 'alias'=>'featured_id', 239 self::$allfields['fada.featured_id']= array( 240 'sort'=>true, 241 'alias'=>'featured_id', 242 242 'text'=>__('products table heading featured id'), 243 ); 244 self::$allfields['fad.featured_title']= array( 245 'sort'=>true, 246 'alias'=>'featured', 243 ); 244 self::$allfields['fad.featured_title']= array( 245 'sort'=>true, 246 'alias'=>'featured', 247 247 'text'=>__('products table heading featured'), 248 'width'=>'12%', 249 ); 248 'width'=>'12%', 249 ); 250 250 } 251 251 /* END Datatype RootListing featured */ 252 252 253 self::$allfields['p.products_weight']= array( 254 'sort'=>true, 255 'alias'=>'weight', 253 self::$allfields['p.products_weight']= array( 254 'sort'=>true, 255 'alias'=>'weight', 256 256 'text'=>__('products table heading weight'), 257 257 'default'=>true, 258 ); 259 260 self::$allfields['p.products_price']= array( 261 'sort'=>true, 262 'alias'=>'price', 258 ); 259 260 self::$allfields['p.products_price']= array( 261 'sort'=>true, 262 'alias'=>'price', 263 263 'text'=>__('products table heading price'), 264 ); 264 ); 265 265 /* 266 self::$allfields['p.products_price']= array( 267 'sort'=>false, 268 'alias'=>'price_ttx', 266 self::$allfields['p.products_price']= array( 267 'sort'=>false, 268 'alias'=>'price_ttx', 269 269 'text'=>__('products table heading price taxe'), 270 270 ); */ 271 271 272 self::$allfields['p.products_tax_class_id']= array( 273 'sort'=>true, 274 'alias'=>'taxe_id', 272 self::$allfields['p.products_tax_class_id']= array( 273 'sort'=>true, 274 'alias'=>'taxe_id', 275 275 'text'=>__('products table heading taxe id'), 276 276 ); 277 277 278 278 if(_cst_bool('STOCK_CHECK')) { 279 self::$allfields['p.products_quantity']= array( 280 'sort'=>true, 281 'alias'=>'quantity', 279 self::$allfields['p.products_quantity']= array( 280 'sort'=>true, 281 'alias'=>'quantity', 282 282 'text'=>__('products table heading quantity'), 283 ); 284 self::$allfields['p.track_stock']= array( 285 'sort'=>true, 286 'alias'=>'track_stock', 283 ); 284 self::$allfields['p.track_stock']= array( 285 'sort'=>true, 286 'alias'=>'track_stock', 287 287 'text'=>__('products table heading track_stock'), 288 ); 288 ); 289 289 } 290 290 291 self::$allfields['p.products_date_added']= array( 292 'sort'=>true, 293 'alias'=>'added', 291 self::$allfields['p.products_date_added']= array( 292 'sort'=>true, 293 'alias'=>'added', 294 294 'text'=>__('products table heading date_added'), 295 ); 296 self::$allfields['p.products_last_modified']= array( 297 'sort'=>true, 298 'alias'=>'modified', 295 ); 296 self::$allfields['p.products_last_modified']= array( 297 'sort'=>true, 298 'alias'=>'modified', 299 299 'text'=>__('products table heading last modified'), 300 300 ); 301 self::$allfields['p.products_date_available']= array( 302 'sort'=>true, 303 'alias'=>'available', 301 self::$allfields['p.products_date_available']= array( 302 'sort'=>true, 303 'alias'=>'available', 304 304 'text'=>__('products table heading available'), 305 ); 306 self::$allfields['p.products_status']= array( 307 'sort'=>true, 308 'alias'=>'status', 305 ); 306 self::$allfields['p.products_status']= array( 307 'sort'=>true, 308 'alias'=>'status', 309 309 'text'=>__('products table heading status'), 310 'width'=>'5%', 310 'width'=>'5%', 311 311 'default'=>true, 312 ); 313 312 ); 313 314 314 315 315 316 316 /** 317 @remarks Construct all list , fields , th/td 317 @remarks Construct all list , fields , th/td 318 318 */ 319 319 self::$InitInfo['theader']['listing']=array( … … 331 331 $listfield = ' cat.categories_id, '; 332 332 333 // put in 333 // put in 334 334 if(isset($_SESSION['filters'][__CLASS__]['allfields'])) 335 335 $_SESSION['filters']['allfields'] = $_SESSION['filters'] [__CLASS__]['allfields']; … … 385 385 386 386 /** 387 @remarks filter based on language 387 @remarks filter based on language 388 388 */ 389 389 if(isset($_SESSION['filters'][__CLASS__]['language_id'])) … … 394 394 395 395 /** 396 @remarks filter based on categorie 396 @remarks filter based on categorie 397 397 */ 398 398 if( DataTypes::is_active('categorie')) { … … 423 423 424 424 /** 425 @remarks filter based on featured 425 @remarks filter based on featured 426 426 */ 427 427 if( DataTypes::is_active('featured')) { … … 442 442 443 443 /** 444 @remarks filter based on featured 444 @remarks filter based on featured 445 445 */ 446 446 if( DataTypes::is_active('manufacturer')) { … … 461 461 462 462 /** 463 @remarks filter based on subtype products 463 @remarks filter based on subtype products 464 464 */ 465 465 if(isset($_SESSION['filters'][__CLASS__]['subtype'])) … … 473 473 $list_type .=$key.','; 474 474 else{ 475 $allcats = categorieUtility::get_category_tree(array('datatype'=>MGabCont::CallSt('GetClassDatatype'),'language_id'=>$new_languages_id , 'exclude'=>array('0')));475 $allcats = tep_get_status_array('product'); 476 476 foreach($allcats as $row) 477 477 $list_type .=$row['id'].','; … … 490 490 $array = array(); 491 491 foreach($_SESSION['filters']['expected'] as $key=>$row) 492 $array[] = $key; 492 $array[] = $key; 493 493 494 494 if((!in_array('publied', $array) && in_array('nopublied', $array) )|| isset($_GET['expected']) ){ … … 499 499 elseif(in_array('publied', $array) && !in_array('nopublied', $array) ) 500 500 self::$InitInfo['adjust']['sWhere'] .=" AND products_date_available IS NULL "; 501 501 502 502 503 503 … … 512 512 $array = array(); 513 513 foreach($_SESSION['filters']['status'] as $key=>$row) 514 $array[] = $key; 514 $array[] = $key; 515 515 516 516 if(in_array('publied', $array) && !in_array('nopublied', $array) ) … … 521 521 522 522 /** 523 @remarks Put detail for listing methode 523 @remarks Put detail for listing methode 524 524 */ 525 525 self::$InitInfo['adjust']['languages_id'] = $new_languages_id; … … 630 630 631 631 /** 632 @remarks specific save in session value filters 632 @remarks specific save in session value filters 633 633 */ 634 634 case 'filters': … … 686 686 687 687 /** 688 @remarks specific Ajax call 688 @remarks specific Ajax call 689 689 */ 690 690 case 'setflag': … … 701 701 702 702 /** 703 @remarks specific multi action 703 @remarks specific multi action 704 704 */ 705 705 case 'multi': … … 790 790 $products_id = tep_db_prepare_input($_POST['products_id']); 791 791 $categories_id = tep_db_prepare_input($_POST['categories_id']); 792 $type = 'duplicate'; 792 $type = 'duplicate'; 793 793 794 794 if( ($pid = sqlproduct::copyto(array('id'=>$products_id ,'catid'=>$categories_id ,'type'=>$type))) && $pid > 0 ){ … … 812 812 $res = tep_get_status_array('product',0,'status_name'); 813 813 814 // if one type, create auto and redirect 814 // if one type, create auto and redirect 815 815 if(count($res)==1) 816 816 tep_redirect(tep_href_link(self::FILENAME, 'action=insert&pID=')); … … 914 914 $res=sqlproduct::Specimen(); 915 915 916 self::$Info= new objectInfo($res); 916 self::$Info= new objectInfo($res); 917 917 918 918 //! descative gestion de stock, si stock composé avec attributes … … 954 954 955 955 956 $query_raw = "select ".$adjust->listfields.", p.products_id as id FROM " . TABLE_PRODUCTS . " p ". 956 $query_raw = "select ".$adjust->listfields.", p.products_id as id FROM " . TABLE_PRODUCTS . " p ". 957 957 " LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON(p.products_id = pd.products_id and pd.language_id = '" . (int)$adjust->languages_id . "') "; 958 958 … … 963 963 } 964 964 965 if( DataTypes::is_active('manufacturer')) 965 if( DataTypes::is_active('manufacturer')) 966 966 $query_raw .= " LEFT JOIN " . TABLE_MANUFACTURERS . " m ON( m.manufacturers_id=p.manufacturers_id ) "; 967 967 … … 1199 1199 1200 1200 if( ! DataTypes::is_active('categorie')) { 1201 /// complete cats list 1201 /// complete cats list 1202 1202 $objres=$DB->query("SELECT categories_name FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd , " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c WHERE c.categories_id=cd.categories_id AND cd.language_id = '" . (int)$languages_id . "' AND c.categories_id=p2c.categories_id and products_id='".$item['id']."' AND c.categories_id <> '".$item['categories_id']."' "); 1203 1203 $rescat=$objres->fetchAllAssoc(); … … 1210 1210 1211 1211 if( ! DataTypes::is_active('featured')) { 1212 /// complete cats list 1212 /// complete cats list 1213 1213 // $objres=$DB->query("SELECT categories_name FROM " . TABLE_FEATURED . " f, " . TABLE_CATEGORIES_DESCRIPTION . " cd , " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c WHERE c.categories_id=cd.categories_id AND cd.language_id = '" . (int)$languages_id . "' AND c.categories_id=p2c.categories_id and products_id='".$item['id']."' AND c.categories_id <> '".$item['categories_id']."' "); 1214 1214 // $rescat=$objres->fetchAllAssoc(); 1215 // 1215 // 1216 1216 // foreach($rescat as $cat) 1217 1217 // $item['cat_title'] .=','.$cat['categories_name']; 1218 // 1218 // 1219 1219 // if(strlen($item['cat_title'])>25)$item['cat_title']= substr($item['cat_title'],0 ,20).'...'; 1220 1220