· 8 years ago · Jun 13, 2018, 11:42 AM
1<?php
2
3/**
4 * Created by PhpStorm.
5 * User: eli
6 * Date: 2017-07-25
7 * Time: 12:31 PM
8 */
9class ZeroKm extends Vehicle
10{
11 const SUB_CAT_ID = 10;
12 const CACHE_KEY_ALL_DATA = '2018080801011';
13 protected $agencies = array();
14 protected $branches = array();
15 protected $manufactureEnglishOptions = array();
16 protected $familyEnglishOptions = array();
17
18 function __construct($subCategory = null) {
19 if($subCategory instanceof SubCategory){
20 parent::__construct($subCategory);
21 }
22 else{
23 parent::__construct(self::SUB_CAT_ID);
24 }
25
26 }
27
28 /**
29 * @return array
30 */
31 public static function getEnabledAgencies(){
32 $enableCarAgencies = array(1);
33 /**
34 * @todo release for live
35 */
36 if(!empty($_COOKIE['newCarTradeMobile'])){
37 $enableCarAgencies[]=2;
38 }
39
40 return $enableCarAgencies;
41
42 }
43 public function getFamiliesOptions(&$field = null,$includeDefaultOption = true){
44
45 $state = $this->getState();
46 $Data = User::getRequestData();
47
48 $enabledAgencies = self::getEnabledAgencies();
49
50
51 $key = __METHOD__."__".self::CACHE_KEY_ALL_DATA.'__includeDefaultOption:'.(int)$includeDefaultOption."_enabledAgencies:".implode(',',$enabledAgencies);
52
53 try{
54 $key.='_'.MadorFields::MADOR_FIELDS_SQL_CACHE_VERSION;
55 }catch(Yad2Exception $e){}
56 $memcache = new Yad2Memcache();
57 $memcache->connect();
58 if(empty($this->familyEnglishOptions)){
59 $this->familyEnglishOptions = $memcache->get($key);
60 if(empty($this->familyEnglishOptions)){
61 $sql = 'SELECT FamilyTitle,FamilyEnglishTitle,count(1) as Total FROM '.$this->subCategory->getTableName().' ';
62 $sqlWhere = array();
63 $sqlWhere[]="StatusID=1";
64 $sqlWhere[]="NOT ISNULL(FamilyEnglishTitle)";
65 $sqlWhere[]="NOT ISNULL(FamilyTitle)";
66 if(!empty($enabledAgencies)){
67 $sqlWhere[]=" AgencyID IN('".implode("','",$enabledAgencies)."')";
68 }
69 $sql.=" WHERE ".implode(' AND ',$sqlWhere).' GROUP BY FamilyEnglishTitle';
70 $result = Conn::R()->Query($sql);
71 $this->familyEnglishOptions = array();
72 while($row = Conn::R()->Fetch($result,'windows-1255',self::$charset)){
73 $opt = new stdClass();
74 $opt->text = $row['FamilyTitle'];
75 $opt->value = $row['FamilyEnglishTitle'];
76 $opt->total = (int)$row['Total'];
77 $this->familyEnglishOptions[]=$opt;
78
79
80 }
81 if(count($this->familyEnglishOptions) && !empty($includeDefaultOption)){
82 $def = new stdClass();
83 $def->text = 'הכל';
84 $def->value = '-1';
85 array_unshift($this->familyEnglishOptions,$def);
86 }
87
88
89 $memcache->set($key,$this->familyEnglishOptions,60*60);
90
91 }
92 }
93 $selectedValues = array();
94
95 if(!empty($field) && !empty($field->name) && !empty($Data[$field->name])){
96 if(is_array($Data[$field->name])){
97 $selectedValues =$Data[$field->name];
98 }else{
99 $selectedValues[]=$Data[$field->name];
100 }
101 }
102
103
104
105 $options = array();
106 if(!empty($this->familyEnglishOptions)){
107 foreach ($this->familyEnglishOptions as $option){
108
109 if( $state=='search' && in_array($option->value,$selectedValues)){
110 $option->selected = "selected";
111 }
112
113 $options[] = $option;
114 }
115
116 }
117
118
119
120 return $options;
121
122 }
123 public function getFamilies(&$field = null,$onlyFromActiveAds = false)
124 {
125 $options = array(
126 PrivateCar::SUB_CAT_ID=>'פרטי',
127 Truck::SUB_CAT_ID=>'מסחרי',
128 Jeep::SUB_CAT_ID=>'×’\'יפי×',
129 );
130
131 $return = array();
132 foreach ($options as $k=>$o){
133 $opt = new stdClass();
134 $opt->value = $k;
135 $opt->text = $o;
136
137 if(!empty($field->value) && $field->value == $k){
138 $opt->selected = 1;
139 }
140 $return[]=$opt;
141 }
142
143
144 $enabledAgencies = self::getEnabledAgencies();
145
146 if(!empty($onlyFromActiveAds)){
147 $key = __METHOD__."_".self::CACHE_KEY_ALL_DATA."_enabledAgencies:".implode(',',$enabledAgencies);
148 try{
149 $key.='__'.MadorFields::MADOR_FIELDS_SQL_CACHE_VERSION;
150 }catch(Yad2Exception $e){}
151 $memcache = new Yad2Memcache();
152 $memcache->connect();
153 $all = $memcache->get($key);
154 if(empty($all)){
155 $sql = 'SELECT FamilyTypeID FROM '.$this->subCategory->getTableName();
156 $sqlWhere = array();
157 $sqlWhere[] = 'StatusID=1';
158 $sqlWhere[] = 'NOT ISNULL(Manufacture)';
159 if(!empty($enabledAgencies)){
160 $sqlWhere[]=" AgencyID IN('".implode("','",$enabledAgencies)."')";
161 }
162 $sql.=" WHERE ".implode(' AND ',$sqlWhere).' GROUP BY FamilyTypeID';
163
164 $result = Conn::R()->Query($sql);
165 $all = array();
166 while($row = Conn::R()->Fetch($result,'windows-1255',self::$charset)){
167 $all[]=$row['FamilyTypeID'];
168
169
170 }
171
172 $memcache->set($key,$all,60*60);
173
174 }
175
176
177 if(!empty($return) && !empty($all)){
178 foreach ($return as $optKey=>$opt){
179 if(!(!empty($opt->value) && in_array($opt->value,$all))){
180 unset($return[$optKey]);
181 }
182 }
183 }
184
185 $tmp = array();
186 foreach ($return as $r){
187 $tmp[]=$r;
188 }
189 $return = $tmp;
190
191
192 }
193
194 return $return;
195
196 }
197
198 public function getManufacturers(&$field = null)
199 {
200 $adData = $this->getAdData();
201 if($this->getState() == "search" && !empty((array)$field)){
202 $tmpField = null;//new stdClass();
203 $options = $this->getManufacturersTitles($field);
204 return $options;
205 }else{
206 if(!empty($adData['FamilyTypeID'])){
207 return $this->getModelsPerType($adData['FamilyTypeID'],$field);
208 }
209 }
210
211 }
212
213 public function getManufacturersTitles(&$field = null,$includeDefaultOption = true)
214 {
215 $state = $this->getState();
216 $Data = User::getRequestData();
217 $enabledAgencies = self::getEnabledAgencies();
218
219
220 if(empty($this->manufactureEnglishOptions)){
221 $this->manufactureEnglishOptions = array();
222 $key = __METHOD__."_".self::CACHE_KEY_ALL_DATA."_".(int)$includeDefaultOption."_enabledAgencies:".implode(',',$enabledAgencies);
223 try{
224 $key.='__'.MadorFields::MADOR_FIELDS_SQL_CACHE_VERSION;
225 }catch(Yad2Exception $e){}
226 $memcache = new Yad2Memcache();
227 $memcache->connect();
228 $this->manufactureEnglishOptions = $memcache->get($key);
229 if(empty($this->manufactureEnglishOptions)){
230
231 $this->manufactureEnglishOptions = array();
232
233 $families = $this->getFamilies();
234 $familiesIDs = array();
235 foreach ($families as $d){
236 if(!empty($d->value) && Helper::isTrueInteger($d->value)){
237 $familiesIDs[]=$d->value;
238 }
239 }
240
241 $where = array();
242 $where[]='NOT ISNULL(EnglishTitle)';
243 if(!empty($familiesIDs)){
244 $where[]="TypeID IN('".implode("' , '",$familiesIDs)."')";
245 }
246 $sql = "SELECT Title as text,EnglishTitle as value FROM carmodel";
247 if(!empty($where)){
248 $sql.=' WHERE '.implode(' AND ',$where);
249 }
250 $sql .= " GROUP BY Title";
251
252 $result = Conn::R()->Query($sql);
253 while($row = Conn::R()->Fetch($result,'windows-1255',self::$charset)){
254 $opt = new stdClass();
255 $opt->text = Conn::db2txt($row['text']);
256 $opt->value = Conn::db2txt($row['value']);
257
258 $this->manufactureEnglishOptions[]=$opt;
259 }
260
261 if(!empty( $this->manufactureEnglishOptions)){
262 /**leave options that exists in ads;**/
263 $sql = 'SELECT Manufacture,count(1) as Total FROM '
264 .$this->subCategory->getTableName();
265 $sqlWhere = array();
266 $sqlWhere[]="StatusID=1";
267 $sqlWhere[]="NOT ISNULL(Manufacture)";
268 if(!empty($enabledAgencies)){
269 $sqlWhere[]="AgencyID IN ('".implode("','",$enabledAgencies)."')";
270 }
271 $sql .=" WHERE ".implode(' AND ',$sqlWhere)." GROUP BY Manufacture";
272
273
274 $result = Conn::R()->Query($sql);
275 $all = array();
276 while($row = Conn::R()->Fetch($result,'windows-1255',self::$charset)){
277 $all[$row['Manufacture']]=array('total'=>$row['Total']);
278 }
279
280 $tmp = array();
281 foreach ($this->manufactureEnglishOptions as $optKey=>$opt){
282 if((!empty($opt->value) && array_key_exists($opt->value,$all))){
283 $opt->total = $all[$opt->value]['total'];
284 $tmp[]=$opt;
285 }
286 }
287 if(count($tmp) && !empty($includeDefaultOption)){
288 $def = new stdClass();
289 $def->text = 'הכל';
290 $def->value = '-1';
291 array_unshift($tmp,$def);
292 }
293 // echo "<pre>".__METHOD__.":<br/>".print_r($tmp,true)."</pre>";
294 $this->manufactureEnglishOptions = $tmp;
295
296
297 }
298
299 $memcache->set($key,$this->manufactureEnglishOptions,60*60);
300
301
302 }
303
304
305
306 }
307
308 $options = array();
309 $selectedValues = array();
310 if(!empty($Data[$field->name])){
311 if(is_array($Data[$field->name])){
312 $selectedValues =$Data[$field->name];
313 }else{
314 $selectedValues[]=$Data[$field->name];
315 }
316 }
317 if(!empty($this->manufactureEnglishOptions)){
318 foreach ($this->manufactureEnglishOptions as $option){
319 if( $state=='search' && in_array($option->value,$selectedValues)){
320 $option->selected = "selected";
321 }
322
323 $options[] = $option;
324 }
325
326 }
327 return $options;
328
329 }
330
331 public function getModels(&$field = null,$data=array(),$allOptionFlag=true ){
332 $adData = $this->getAdData();
333 if(!empty($adData['ModelID'])){
334 $options = parent::getModels($field,array('manufacturer'=>$adData['ModelID']));
335 foreach ($options as &$opt){
336 if(!empty($opt->value) && $opt->value == $adData['ModelID']){
337 $opt->selected = 1;
338 }
339 }
340 return $options;
341 }
342
343 return false;
344 }
345
346 public function getBranches(&$field = null){
347 if(!empty($this->branches)){
348 $branchesAll = $this->branches;
349 }else{
350 $sql = "SELECT carZeroKm_agency_branches.*,AgencyBranchID as value ,Name as text FROM carZeroKm_agency_branches";
351 $this->branches = array();
352 $result = Conn::R()->Query($sql);
353 while($row = Conn::R()->OFetch($result,'windows-1255',self::$charset)){
354 $this->branches[]=$row;
355 }
356
357 $branchesAll = $this->branches;
358
359
360 }
361
362 $value = null;
363 if(!empty($field->value)){
364 $value = $field->value;
365 }else{
366 $adData = $this->getAdData();
367 if(!empty($field->dbFieldName) && !empty($adData[$field->dbFieldName])){
368 $value = $adData[$field->dbFieldName];
369 }
370 }
371
372
373 $return = array();
374 if(!empty($branchesAll)){
375 foreach ($branchesAll as $branch){
376 unset($branch->selected);
377 if(!empty($branch->value) && $branch->value == $value){
378 $branch->selected = 1;
379 }
380
381 $return[]=$branch;
382
383 }
384 }
385 return $return;
386
387 }
388
389
390 public function getAgencies(&$field = null){
391 if(!empty($this->agencies)){
392 $agencies = $this->agencies;
393 }else{
394 $sql = "SELECT carZeroKm_agencies.*,AgencyID as value ,Name as text FROM carZeroKm_agencies";
395
396 $agencies = array();
397 $result = Conn::R()->Query($sql);
398 while($row = Conn::R()->OFetch($result,'windows-1255',self::$charset)){
399 $agencies[]=$row;
400 }
401
402 $this->agencies = $agencies;
403
404
405 }
406
407 $adData = $this->getAdData();
408 $value = !empty($field->value) ?$field->value : (!empty($field->dbFieldName) && !empty($adData[$field->dbFieldName])?$adData[$field->dbFieldName]:null);
409
410 if(!empty($agencies) && !empty($value)){
411 foreach ($agencies as &$agency){
412 if(!empty($agency->value) && $agency->value == $value){
413 $agency->selected = 1;
414 }
415 }
416 }
417
418 return $agencies;
419
420 }
421
422
423
424
425
426
427
428
429
430
431
432 public function getSubModels(&$field = null)
433 {
434 $adData = $this->getAdData();
435 if(!empty($adData['FamilyTypeID'])){
436 return $this->getSubModelsPerType($adData['FamilyTypeID'],$field);
437 }
438
439
440 }
441
442
443
444 public function getItemTitleText(&$field = null){
445 $adData = $this->getAdData();
446 $state = $this->getState();
447 $return = array();
448 if(!empty($adData)){
449
450 // if(in_array($state,array('apiFeedView','apiView'))){
451 $return[]= Encoding::windows2utf(Conn::db2txt($this->getCarModelTitle($adData['ModelID'])));
452 $return[]= Encoding::windows2utf(Conn::db2txt($this->getCarSubModelTitle($adData['SubModelID'])));
453 if(!empty($adData['Year'])){
454 $return[]=$adData['Year'];
455 }
456 // }
457
458 }
459
460 if(!empty($return)){
461 $field->value = implode(' ',$return);
462 }
463
464 }
465
466
467 public function getFeedInfoTitleText(&$field = null){
468 $adData = $this->getAdData();
469 $state = $this->getState();
470 $return = array();
471
472 if(!empty($adData)){
473 //if($state == 'apiFeedView'){
474 $subModelField = new stdClass();
475 $data = array(
476 'year' => !empty($adData['Year'])? $adData['Year'] : null,
477 'manufacturer'=>!empty($adData['ModelID'])? $adData['ModelID'] : null,
478 'model' => !empty($adData['SubModelID'])? $adData['SubModelID'] : null,
479 'gearBox' =>isset($adData['GearTypeID'])? $adData['GearTypeID'] : null,
480 'engineType' => !empty($adData['EngineTypeID'])? $adData['EngineTypeID'] : null,
481 'engineSize' => !empty($adData['EngineVal'])? $adData['EngineVal'] : null,
482
483
484 );
485
486 $subModels = $this->getSubModel($subModelField,$data);
487 // echo "<pre>".__METHOD__.":<br/>".print_r(array($this->adData['SubSubModelID'],$data,$subModels,$adData),true)."</pre>";die();
488 $return[] = Conn::db2txt($this->convertDisplayTextFromOptionsArray($subModels,$this->adData['SubSubModelID']));
489
490 // }
491
492 }
493
494 if(!empty($return)){
495 $field->value = implode(' ',$return);
496 }
497
498 }
499
500 public function getFeedHighlightedText(&$field = null){
501 $sold = $this->findFieldByID('sold');
502 if(empty($sold)){
503 return;
504 }
505
506 $reserve = $this->findFieldByID('reserve');
507 if(empty($reserve)){
508 return;
509 }
510
511
512 $field->value = '';
513
514 if(!empty($sold->textValue)){
515 $field->value = '× ×ž×›×¨';
516 }elseif(!empty($reserve->textValue) && date('Y-m-d H:i:s',strtotime($reserve->textValue))>=date('Y-m-d H:i:s',strtotime(date('Y-m-d H:i:s').' -20 minutes'))){
517 $field->value = 'בתהליך רכישה';
518 }
519
520 return $field->value;
521 }
522 public function enableToSale(&$field = null){
523 $sold = $this->findFieldByID('sold');
524 if(empty($sold)){
525 return;
526 }
527
528// $reserve = $this->findFieldByID('reserve');
529// if(empty($reserve)){
530// return;
531// }
532
533
534 $field->value = 'yes';
535
536 if(!empty($sold->textValue)){
537 $field->value ='no';
538 }
539// elseif(!empty($reserve->textValue) && date('Y-m-d H:i:s',strtotime($reserve->textValue))>=date('Y-m-d H:i:s',strtotime(date('Y-m-d H:i:s').' -20 minutes'))){
540// $field->value = 'no';
541// }
542
543 return $field->value;
544 }
545
546
547
548 protected function pmt($apr, $term, $loan)
549 {
550 $term = $term;
551 $apr = $apr / 1200;
552 $pvif = pow((1 + $apr), $term);
553 $pm = $apr / ( $pvif - 1 ) * -($loan*$pvif);
554 //$amount = $apr * -$loan * pow((1 + $apr), $term) / (1 - pow((1 + $apr), $term));
555 //return round($amount);
556 return $pm;
557 }
558
559 public function getFeedLinkText(&$field = null,$price=false){
560 $adData = $this->getAdData();
561 $return = array();
562
563 if((!empty($adData['Price'])) || !empty($price)){
564
565 $price = (int)(!empty($price) ? $price : $adData['Price']);
566 // $deposit = 1000;
567 $deposit = 15000;
568 $months = 48;
569 $baloon = $price*0.5;
570 $shpitzer = $price-$deposit-$baloon;
571 $interest = 4.85;
572 $minumumPrice = ((-1)*$this->pmt($interest,$months,$shpitzer))+($interest/1200)*$baloon ;
573 $return[]= number_format(ceil($minumumPrice));
574
575
576 }
577
578 if(!empty($return)){
579 if (!empty($field)){
580 $field->value = implode(' ',$return);
581 }
582 }
583 return implode(' ',$return);
584 }
585
586 public function getFeedLinkUrl(&$field = null,$server_name = null){
587 $adData = $this->getAdData();
588 $state = $this->getState();
589 if(!empty($adData)){
590 if(/*$state == 'apiFeedView' &&*/ !empty($adData['OrderID'])){
591 $field->value = "/new-car/".$adData['OrderID'];
592
593 }
594
595 }
596
597
598 }
599 public function getFeedImageUrl(&$field = null,$imagesField = null){
600 if (empty($imagesField)){
601 $imagesField = $this->findFieldByID('images');
602 if(empty($imagesField)){
603 return;
604 }
605 }
606
607 $otherData = $this->getOtherTableData($imagesField,false);
608
609 $url = '';
610 if(!empty($otherData) && is_array($otherData)){
611 foreach($otherData as $d){
612 if(!empty($d['Main'])){
613 $url = $d['url'];
614 break;
615 }
616 }
617 }
618
619
620 if(empty($url) && !empty($otherData) && is_array($otherData)){
621 $url = reset($otherData);
622 }
623 if(!empty($url)){
624 $info = array();
625 $imageInfo = getimagesize($url,$info);
626 $url = str_replace(array('images','original'),array('img','o'),$url);
627 $Width = 800;//$imageInfo[0];
628 $Height = 600;//$imageInfo[1];
629 $url .= "?w=".$Width."&h=".$Height."&c=3";
630 $url = str_replace(array('http:'),array('https:'),$url);
631 //$url = '//'.$_SERVER['SERVER_NAME'].'/minisites/newcar/assets/images/?url='.base64_encode($url);
632 }
633
634 if (!empty($field)){
635 $field->value = $url;
636 }
637 return $url;
638
639
640 }
641
642 public function getItemDescription(&$field=null){
643 $return = array();
644 $adData = $this->getAdData();
645 if(!empty($adData['Info'])){
646 $return['title'] = !empty($field->label)?$field->label:'';
647 $return['type'] = !empty($field->type)?$field->type:'';
648 $return['name'] = !empty($field->name)?$field->name:'';
649 $return['data'] = !empty($adData['Info'])?$adData['Info']:'';
650 }
651
652 $field->value = $return;
653
654 return $field->value;
655 }
656
657 /**
658 * @param stdClass $field
659 * @return mixed
660 */
661 public function getItemAdditional(&$field=null){
662 $return = array();
663 $adData = $this->getAdData();
664
665 if( !empty($field->dbFieldName) && !empty($adData[$field->dbFieldName]) && !empty($field->dataSeperator) && !empty($field->dataSeperatorKeyValue)){
666 $data = explode((!empty($field->dataSeperator)?$field->dataSeperator:','),$adData[$field->dbFieldName]);
667
668
669 $final = array();
670 if(!empty($data)){
671 foreach ($data as &$set){
672 $set_tmp = explode($field->dataSeperatorKeyValue,$set);
673 //$set = array($set_tmp[0]=>$set_tmp[1]);
674 if(!empty($set_tmp[1])){
675 $final[$set_tmp[0]]= $set_tmp[1];
676 }
677
678 }
679 }
680
681 $return['title'] = !empty($field->label)?$field->label:'';
682 $return['type'] = !empty($field->type)?$field->type:'';
683 $return['name'] = !empty($field->name)?$field->name:'';
684 $return['data'] = $final;
685 }
686
687 $field->value = $return;
688
689
690 return $field->value;
691 }
692 public function getItemAccessories(&$field=null){
693 $return = array();
694 $adData = $this->getAdData();
695
696 if(!empty($field->dbFieldName) && !empty($adData[$field->dbFieldName]) ){
697 $return['title'] = !empty($field->label)?$field->label:'';
698 $return['type'] = !empty($field->type)?$field->type:'';
699 $return['name'] = !empty($field->name)?$field->name:'';
700 $return['data'] = explode((!empty($field->dataSeperator)?$field->dataSeperator:','),$adData[$field->dbFieldName]);
701 }
702
703 $field->value = $return;
704
705 return $field->value;
706 }
707
708
709 public function getItemSpecifications(&$field=null){
710
711 $return = array();
712 $adData = $this->getAdData();
713 if(!empty($adData)){
714 $return['title'] = !empty($field->label)?$field->label:'';
715 $return['type'] = !empty($field->type)?$field->type:'';
716 $return['name'] = !empty($field->name)?$field->name:'';
717 $return['data'] = array();
718
719 $fieldsIdNames = array('carlength','carwidth','carheight','tireinterm','weight','capacity','moment','maxspeed','acceleration','reqfuel','fuelcapacity','trunkvolume');
720 foreach ($fieldsIdNames as $id){
721 $f = $this->findFieldByID($id);
722 if(!empty($f)){
723 $val = !empty($adData[$f->dbFieldName])?$adData[$f->dbFieldName].(!empty($f->unit)?' '.$f->unit:''):'';
724 if(!empty($val)){
725 $return['data'][$f->label] = $val;
726 }
727 }
728 }
729 unset($id);
730
731 $field->value = $return;
732
733
734 }
735
736 return !empty($field->value)?$field->value:array();
737
738
739 }
740
741 public function getItemInfoItems(&$field=null){
742
743 $data = array();
744
745 $fieldIDs = array('additional','desc','accessories','specifications');
746
747 foreach ($fieldIDs as $id){
748
749 $f = $this->findFieldByID($id );
750 if(!empty($f) ){
751
752 if(!empty($f->value)){
753 $data[]= $f->value;
754 }elseif(!empty($f->methodForFetch) && method_exists($this,$f->methodForFetch)){
755 $data[]= $this->{$f->methodForFetch}($f);
756 }
757
758 }
759 }
760
761
762//echo "<pre>".__METHOD__.":<br/>".print_r($data,true)."</pre>";die();
763
764 $field->value = $data;
765 // echo "<pre>".__METHOD__.":<br/>".print_r($field->value,true)."</pre>";die();
766
767
768 }
769
770 public function getItemImages(&$field = null){
771 $imagesField = $this->findFieldByID('images');
772 if(empty($imagesField)){
773 return;
774 }
775 $otherData = $this->getOtherTableData($imagesField,false);
776 $url = '';
777 $images = array();
778 if(!empty($otherData)){
779 foreach($otherData as $d){
780 if(!empty($d['Main'])){
781 $url = $d['url'];
782 }else{
783 $images[]=$d['url'];
784 }
785 }
786 }
787
788 if(!empty($url)){
789 array_unshift($images,$url);
790 }
791
792 if(!empty($images)){
793 foreach ($images as $key=>$val){
794 $val = str_replace(array('images','original','http:'),array('img','o','https:'),$val);
795 $images[$key] = $val."?w=800&h=600&c=3";
796 }
797 }
798 $field->value = $images;
799 return (!empty($field->value)) ? $field->value : array();
800
801 }
802
803 public function getImages($field = array()) {
804 return $this->getItemImages($field);
805 }
806
807 public function getSafetyCharacteristicsObject(&$field = null){
808
809 $return = array(
810 'title'=>'בטיחות',
811 'general'=>!empty($adData['safetyGeneral']) ? (float)$adData['safetyGeneral'] : 0,
812 'existed'=>0,
813 'data'=>array()
814 );
815
816 $keys = array(
817 array('heb'=>'מבוגרי×','adDataKey'=>'safetyAdults'),
818 array('heb'=>'ילדי×','adDataKey'=>'safetyChildren'),
819 array('heb'=>'הולכי רגל','adDataKey'=>'safetyPedestrian'),
820 );
821
822 foreach ($keys as $key){
823 $value = !empty($adData[$key['adDataKey']]) ? (float)$adData[$key['adDataKey']] : 0;
824 if($value>0 && $return['existed']==0){
825 $return['existed'] = 1;
826 }
827 $return['data'][]=array(
828 'title'=>$key['heb'],
829 'key'=>$key['adDataKey'],
830 'value'=>$value,
831 );
832 }
833
834
835
836 if(!empty($field)){
837 $field->value = $return;
838 }
839 }
840
841
842 public function getGeneralCommentsObject(&$field = null){
843
844 $return = array(
845 'title'=>'הערות כלליות',
846 'data'=>array(
847 array('text'=>'×”×ª×ž×•× ×•×ª להמחשה בלבד'),
848 array('text'=>'×”×ž×—×™×¨×™× ×›×•×œ×œ×™× ×ž×¢"מ'),
849 array('text'=>'מפרט הרכב ×”×™× ×• לצורכי מידע בלבד, יש לבדוק ×ת המפרט המעודכן ב×תר היבו×ן'),
850
851 )
852 );
853
854 if(!empty($field)){
855 $field->value = $return;
856 }
857
858 // return $return;
859
860
861
862 }
863
864 public function getDiscountPercentageObject(&$field = null){
865 $adData = $this->getAdData();
866 $percents = false;
867 if(!empty($adData['DiscountPercentage']) ){
868 $percents = round($adData['DiscountPercentage']);
869 }
870
871
872 return $percents;
873 }
874
875 public function getReviewsSummaryObject(&$field = null){
876 $adData = $this->getAdData();
877 if(!empty($adData['CodeDegem']) && !empty($adData['Year'])){
878 $mot_gov_il_code=$adData['CodeDegem'];
879
880 $mot_gov_il_code=ZeroKmPurchase::getMtFormatted($mot_gov_il_code,'slashes');
881
882 $yad2CarModelData = Vehicle::getYad2CarData(array('mot_gov_il_code'=>$mot_gov_il_code,'Year'=>$adData['Year']));
883
884
885 $obj = self::getYad2CarReviewsSummary($yad2CarModelData);
886 $return = array(
887 'title'=>'חוות דעת גולשי×',
888 'data'=>$obj
889 );
890
891 // echo "<pre>".__METHOD__.":<br/>".print_r($return,true)."</pre>";
892 if(!empty($field)){
893 $field->value = $return;
894 }
895
896 return $return;
897 }
898
899
900
901 return false;
902
903
904
905
906
907 }
908
909
910 public static function getNewCarByManufactureOrFamily($model=null,$family=null, $total, $notIn=null, $subCatID=null ,$submodel= null){
911
912
913
914 $whereFamilyModel='';
915 if (!empty($model)) {
916 $whereFamilyModel .= " AND ModelID=".$model;
917 }
918 if(!empty($submodel) && empty($family)) {
919 $whereFamilyModel .= " AND SubModelID=".$submodel;
920 }
921
922 if (!empty($family)) {
923 $whereFamilyModel .= " AND FamilyID=".$family;
924 }
925
926 if (!empty($subCatID)) {
927 $whereFamilyModel .= " AND FamilyTypeID=".$subCatID;
928 }
929
930 $whereNotIn = '';
931
932 $enabledAgencies = self::getEnabledAgencies();
933
934 if(!empty($notIn)){
935 foreach($notIn as $key=>$value){
936 $notInSrt[]=$value['OrderID'];
937 }
938 $whereNotIn = ' and OrderID NOT IN ('.implode(',',$notInSrt).') ';
939 }
940 $res=array();
941
942 if(!empty($enabledAgencies)){
943 $agencySqlWhere =" and AgencyID IN('".implode("','",$enabledAgencies)."')";
944 }
945
946 $sql="SELECT OrderID FROM carZeroKm
947 INNER JOIN orders
948 ON (catID=".Vehicle::CAT_ID." and subCatID=".ZeroKm::SUB_CAT_ID." and carZeroKm.RecordID=orders.RecordID)
949 where carZeroKm.statusID=1 and sold=0 ".$whereFamilyModel. $whereNotIn .$agencySqlWhere ." ORDER BY RAND() limit ".$total;
950
951
952 $result = Conn::R()->Query($sql);
953 while($row = Conn::R()->Fetch($result,'windows-1255',self::$charset)){
954 $res[]=$row;
955 }
956 return $res;
957
958 }
959
960 public static function getFamilyIDByManufactureAndModel($manufacture, $model) {
961
962 $sql="select SubModelCatID as FamilyID from carsubmodel where ModelID = ".$manufacture." and subModelID=".$model;
963 $result = Conn::R()->Query($sql);
964 $row = Conn::R()->Fetch($result,'windows-1255',self::$charset);
965 return $row['FamilyID'];
966 }
967
968
969 public static function getAdIDForKidumZeroKM($requestData,$total, $notIn=array(),$type = '') {
970 $adID=array();
971 if (((empty($requestData['toYear']) && $type == 'feed') || (!empty($requestData['toYear']) && $requestData['toYear']<=2014)) &&
972 ((empty($requestData['fromYear']) && $type == 'feed') || (!empty($requestData['fromYear']) && $requestData['fromYear'] < 2014))) {
973 return $adID;
974 }
975
976 // search bu manufacture and model
977 if (!empty($requestData['manufacturer']) && !empty($requestData['model'])) {
978 $model = $requestData['manufacturer'];
979 $family=null;
980 $submodel=$requestData['model'];
981
982 $totalLimit=$total;
983
984 // search by family model and submodel
985 $carDetails = ZeroKm::getNewCarByManufactureOrFamily($model, $family, $totalLimit, $notIn , null ,$submodel);
986
987 $adID = array_merge($adID,$carDetails);
988
989
990 if (count($adID)<$total) { // search by family
991
992 $totalLimit=$total-count($adID);
993 $notIn=array_merge($notIn,$adID);
994
995 $familyID= ZeroKm::getFamilyIDByManufactureAndModel($requestData['manufacturer'], $requestData['model']);
996 $carDetails = ZeroKm::getNewCarByManufactureOrFamily(null, $familyID, $totalLimit, $notIn);
997 }
998
999 $adID = array_merge($adID,$carDetails);
1000
1001 } else if (!empty($requestData['manufacturer']) && !empty($requestData['subcat'])) {
1002 // search by manufacture
1003 $model = $requestData['manufacturer'];
1004 $family=null;
1005 $adID = ZeroKm::getNewCarByManufactureOrFamily($model, $family,$total,$notIn,$requestData['subcat']);
1006 } elseif(!empty($requestData['subcat'])) { // search random new car with subcatid only
1007 $familyID = null;
1008 $totalLimit = $total - count($adID);
1009 $adID = ZeroKm::getNewCarByManufactureOrFamily(null, $familyID, $totalLimit, $notIn, $requestData['subcat']);
1010 }
1011
1012 return $adID;
1013 }
1014
1015
1016 public function getNewCarAdPromotion(&$f = null){
1017
1018 $response=array();
1019 $resFinal=array();
1020 $adData = $this->getAdData();
1021
1022
1023
1024 $requestData['manufacturer']=$adData['ModelID'];
1025 $requestData['model']=$adData['SubModelID'];
1026 $notIn[]['OrderID']=$adData['OrderID'];
1027 $adID = ZeroKm::getAdIDForKidumZeroKM($requestData,2, $notIn,'ad');
1028 if (!empty($adID)) {
1029
1030 foreach($adID as $key=>$value) {
1031 $subcategory = new SubCategory(self::SUB_CAT_ID,self::CAT_ID,true,'apiView');
1032 $ad = new Ad($subcategory);
1033
1034 $ad->setOrderID($value['OrderID']);
1035
1036 $response['adID'] = $value['OrderID'];
1037 $filterData = array(
1038 'OrderID__operator__=' => array('operator' => '=', 'value' => $value['OrderID']),
1039 'StatusID' => 1,
1040 'EndDate__operator__>=' => array('operator' => '>=', 'value' => date("Y-m-d")),
1041 );
1042 $adDataNew = $ad->getAdData($filterData);
1043 /**
1044 * @var $mf self
1045 */
1046
1047 $mf = $ad->getMadorFields();
1048
1049 $f = new stdClass();
1050 $f->value = !empty($adDataNew['Price']) ? $adDataNew['Price'] : 0;
1051 $mf->getFeedLinkText($f,$f->value);
1052 $response['from_price'] = $f->value;
1053 $mf->getItemTitleText($f);
1054 $response['main_title_text'] = $f->value;
1055 $mf->getFeedInfoTitleText($f);
1056 $response['info_text'] = $f->value;
1057 $mf->getFeedImageUrl($f);
1058 $response['images'][0] = $f->value;
1059
1060 $resFinal[]=$response;
1061
1062 unset($mf);
1063 unset($ad);
1064 }
1065 }
1066
1067 // to reset for original adData
1068 $subcategory = new SubCategory(self::SUB_CAT_ID,self::CAT_ID,true,'apiView');
1069 $ad = new Ad($subcategory);
1070 $ad->setOrderID($adData['OrderID']);
1071 $adDataNew = $ad->getAdData();
1072 $mf = $ad->getMadorFields();
1073
1074 return $resFinal;
1075 }
1076 public function getCarColor(&$f = null){
1077
1078 $response=null;
1079 $adData = $this->getAdData();
1080
1081 if(!empty($adData['ColorID'])){
1082 $colors = $this->getColors();
1083 foreach ($colors as $color){
1084 if(!empty($color->value) && $color->value == $adData['ColorID']){
1085 $response=array();
1086 $keys = array('CarColorHex','CarColorGradientStyle');
1087 foreach ($keys as $key){
1088 if(property_exists($color,$key)){
1089 $response[$key] = $color->{$key};
1090 }
1091 }
1092
1093
1094 break;
1095 }
1096 }
1097 }
1098 $f->value = $response;
1099 return $f->value;
1100 }
1101
1102 public function getCarGroupColor(&$f = null){
1103
1104 $response=null;
1105 $adData = $this->getAdData();
1106
1107 if(!empty($adData['CarColorGroupID'])){
1108 $colors = $this->getGroupColors();
1109 echo "<pre>".__METHOD__.":<br/>".print_r($colors,true)."</pre>";
1110 foreach ($colors as $color){
1111 if(!empty($color->value) && $color->value == $adData['CarColorGroupID']){
1112 $response=array();
1113 $keys = array('CarColorHex','CarColorGradientStyle');
1114 foreach ($keys as $key){
1115 if(property_exists($color,$key)){
1116 $response[$key] = $color->{$key};
1117 }
1118 }
1119
1120
1121 break;
1122 }
1123 }
1124 }
1125 $f->value = $response;
1126 return $f->value;
1127 }
1128
1129 public static function formatCarNumber($carNumber){
1130 if(strpos($carNumber,'-')===false){
1131 if(!empty($carNumber) && strlen($carNumber)==7){
1132 $carNumber = substr($carNumber,0,2)."-".substr($carNumber,2,3)."-".substr($carNumber,5);
1133 }
1134 if(!empty($carNumber) && strlen($carNumber)==8){
1135 $carNumber = substr($carNumber,0,3)."-".substr($carNumber,3,2)."-".substr($carNumber,5);
1136 }
1137 }
1138
1139 return $carNumber;
1140 }
1141
1142 /* Create NewCar Feed Item */
1143 public function buildFeedRow(&$adData)
1144 {
1145 $this->setAdData($adData);
1146 // $this->getFields();
1147
1148 $feed = parent::buildFeedRow($adData);
1149 $feed['id'] = !empty($adData['OrderID']) ? $adData['OrderID'] : null;//$feed['ad_number'];
1150 $feed['licensePlate'] = !empty($this->adData['CarNumber']) ? self::formatCarNumber($this->adData['CarNumber']) : null;
1151 $feed['pricePerMonth'] = $this->getFeedLinkText();
1152 $field = new stdClass();
1153 $feed['pricePerMonth_int'] = (int)$this->getFeedLinkText($field,false,false);
1154 $feed['price'] = $this->adData['Price'];
1155 $feed['price_int'] = (int)$this->adData['Price'];
1156 $feed['importer_price'] = $this->adData['ImporterPrice'];
1157 $feed['importer_price_int'] = (int)$this->adData['ImporterPrice'];
1158 $feed['submodel'] = $this->getSubSubModelText($adData);
1159 $feed['color'] = $this->get_text('ColorID','getColors');
1160 $feed['gradient'] = strpos($feed['color'],'מט×לי') != false;
1161 $feed['vehicleType'] = $this->get_text('FamilyTypeID', 'getFamilies');
1162 $feed['logo'] = $this->getManufacturerLogos()[$adData['ModelID']];
1163 $field = new stdClass();
1164 $feed['color'] = $this->getCarColor($field);
1165 if(is_array($feed['color']))
1166 $feed['color']['CarColorHebName'] = $this->get_text('ColorID','getColors');
1167//
1168// array(
1169// 'otherTable'=> array(
1170// 'table' => 'mystiquetopcat',
1171// 'using' => 'MystiqueTopCatID',
1172// 'joinType' => 'LEFT',
1173// 'moreFields' => 'Title AS AlternativeCatName'
1174// ),
1175// 'operator' => null//DON'T REMOVE THAT!!!!
1176// );
1177
1178
1179 $tmpField = null;
1180 $imagesField = new stdClass();
1181 $imagesField->otherTable = "carZeroKm_images";
1182 $imagesField->otherTableData = "url";
1183 $imagesField->otherTableParams = "RecordID";
1184 $imagesField->otherTableSelect = "Main";
1185
1186 $imagesField->Id = "images";
1187 $imagesField->dbFieldName = "url";
1188 $imagesField->multiple = 1;
1189 $imagesField->type = 'text';
1190 //$feed['image'] = $this->getFeedImageUrl();
1191 $feed['image'] = $this->getFeedImageUrl($tmpField,$imagesField);
1192
1193
1194
1195 unset($feed['coordinates']);
1196 return $feed;
1197 }
1198
1199 public static function getManufacturerLogos(){
1200 $sql = "SELECT
1201 yad2.car_synchronize_model.ModelID AS ModelID,
1202 IF(pricelist.manufactur.Image<>'' AND NOT ISNULL(pricelist.manufactur.Image),CONCAT('//photos.yad2.co.il/photos/manufactures/',pricelist.manufactur.Image),null)as ManufactureImage
1203 FROM pricelist.manufactur
1204 INNER JOIN yad2.car_synchronize_model ON ( yad2.car_synchronize_model.ManufacturID = pricelist.manufactur.ManufacturID )
1205 INNER JOIN yad2.carmodel ON (yad2.carmodel.ModelID = yad2.car_synchronize_model.ModelID)
1206 WHERE manufactur.IsActive=1
1207 ";
1208 $key = md5($sql);
1209 $rows = MadorFields::memorySet(
1210 $sql,$key,
1211 self::$getCarModelTitleQueries,
1212 Conn::R(),'Fetch',(24*Yad2Memcache::ONE_HOUR)
1213 );
1214 $logos = array();
1215 $result = Conn::PL()->Query($sql);
1216 if(Conn::PL()->numRows($result)){
1217 while( $row = Conn::PL()->Fetch($result,'windows-1255',self::$charset)){
1218 if(!empty($row['ManufactureImage'])){
1219 $logos[$row['ModelID']] = $row['ManufactureImage'];
1220 }
1221 }
1222 }
1223 return $logos;
1224 }
1225
1226 public function getSubSubModelText($adData){
1227 $subModelField = new stdClass();
1228 $data = array(
1229 'year' => !empty($adData['Year'])? $adData['Year'] : null,
1230 'manufacturer'=>!empty($adData['ModelID'])? $adData['ModelID'] : null,
1231 'model' => !empty($adData['SubModelID'])? $adData['SubModelID'] : null,
1232 'gearBox' => !empty($adData['GearTypeID'])? $adData['GearTypeID'] : null,
1233 'engineType' => !empty($adData['EngineTypeID'])? $adData['EngineTypeID'] : null,
1234 'engineSize' => !empty($adData['EngineVal'])? $adData['EngineVal'] : null,
1235 );
1236 $subModels = $this->getSubModel($subModelField,$data);
1237 return $feed["submodel"] = Conn::db2txt($this->convertDisplayTextFromOptionsArray($subModels,$adData['SubSubModelID']));
1238 }
1239
1240 /**
1241 * @param $apiViewFeedObj
1242 * @return array
1243 */
1244 public function getTopSliderList(&$apiViewFeedObj){
1245
1246 $ad = new Ad($this->getSubCategory());
1247 $ad->setState("apiFeedView");
1248 $filterData = array(
1249 "StatusID" => Ad::ACTIVE_STATUSID,
1250 "EndDate__operator__>=" => array("operator" => '>=', "value" => date('Y-m-d')),
1251 "Price__operator__>" => array("operator" => '>', "value" =>'0'),
1252 "ImporterPrice__operator__>" => array("operator" => '>', "value" =>'0'),
1253 '__sort' => array('DiscountPercentage.keyword DESC'),
1254 );
1255
1256 $adDataList = $ad->getAdData($filterData,false,0,5);
1257 $final = array();
1258 foreach ($adDataList as $adData){
1259 $currnetAdData = $adData;
1260 $final[]=$this->buildFeedRow($currnetAdData);
1261 }
1262
1263 if($apiViewFeedObj instanceof \ApiViewFeed) {
1264 $apiViewFeedObj->sanitaryFeedItems($final);
1265 }
1266
1267
1268
1269 return $final;
1270
1271 }
1272
1273
1274 public function getQuestionsAndAnswers(){
1275 $response = array();
1276 $response['data'] = array();
1277 $response['data']['faq'] = $this->getFAQData();
1278 $response['data']['howdoesitwork'] = $this->getHowDoesItWorkData();
1279 $response['data']['about'] = $this->getAboutData();
1280
1281 return $response['data'];
1282
1283 }
1284 public function getFAQData(){
1285 return array(
1286 'title'=>'ש×לות × ×¤×•×¦×•×ª',
1287 'data'=>
1288 array(
1289 array(
1290 'title'=>'<div>'.implode('</div><div>',array('מה זה רכב חדש \'0 ק"מ\' במחיר יד2?','מה ההבדל בין רכב חדש לרכב 0 קילומטר?','מה יופיע ברישיון הרכב?')).'</div>',
1291 'text'=>'רכב חדש מהיבו×ן ×”×•× ×¨×›×‘ ×©× ×¨×›×© ישירות מיבו×ן הרכב, ×›×©×§×•× ×” הרכב רוכש ×ותו במחיר מל×, והרכב, ×©× ×¨×›×©, × ×¨×©× ×›×™×“ ר××©×•× ×”. ×‘×©×•× ×” מרכב חדש מהיבו×ן, רכב 0 ×§"מ ×”×•× ×¨×›×‘ חדש "×ž×”× ×™×™×œ×•× ×™×",כלומר רכב ×©×œ× × ×¢×©×” בו שימוש ×•×©× ×¨×©× ×‘×ופן רשמי ברישיון הרכב כיד 01 על ×©× ×—×‘×¨×ª ×”×œ×™×¡×™× ×’ שרכשה ×ותו מהיבו×ן הרשמי. כל ×”×§×•× ×” רכב 0 ×§"מ, ×™×”×™×” ×”×‘×¢×œ×™× 02 ברישיון הרכב, ×ך ×”×•× ×¨×•×›×© רכב חדש לחלוטין במחיר של רכב יד ×©× ×™×”',
1292 'open'=>1
1293 ),
1294 array(
1295 'title'=>'ממי ×× ×™ ×§×•× ×” ×ת הרכב?',
1296 'text'=>'×‘×ž×™×–× ×ž×©×ª×ª×¤×•×ª מספר חברות ×œ×™×¡×™× ×’ שרכשו ×ת ×”×¨×›×‘×™× ×ž×”×™×‘×•×ן הרשמי והרכב ×¨×©×•× ×¢×œ שמן. ל×חר ביצוע השריון ב×תר, בהת×× ×œ×¡×•×’ הרכב ×•×”×“×’× ×©×‘×—×¨×ª, × ×¤× ×” ×ותך לחברת ×”×œ×™×¡×™× ×’ ×”×¨×œ×•×•× ×˜×™×ª המציעה ×ת הרכב, למטרת השלמת רכישת הרכב המשוריין מחברת ×”×œ×™×¡×™× ×’ ו×יסוף הרכב'
1297 ),
1298 array(
1299 'title'=>'×ילו ×¨×›×‘×™× ××ª× ×™×›×•×œ×™× ×œ×”×¦×™×¢ לי?',
1300 'text'=>'יד2 חברה למספר חברות ×œ×™×¡×™× ×’, מהמובילות בשוק הרכבי×, על ×ž× ×ª להציע ×œ×’×•×œ×©×™× ×ž×’×•×•×Ÿ רחב של סוגי רכב, ×‘×“×’×ž×™× ×•×‘×¦×‘×¢×™× ×©×•× ×™×. המל××™ המוצע ב×תר תלוי במל××™ ×”×§×™×™× ×צל חברות ×”×œ×™×¡×™× ×’ ×•×ž×©×ª× ×” בתכיפות, כך ש×× ×œ× ×ž×¦×ת ×ת ×”×“×’× ×”×ž×•×©×œ× ×œ×š, כד××™ לעקוב ×חר המל××™ המתעדכן במדור "רכב חדש"'
1301 ),
1302 array(
1303 'title'=>'מה כוללת העסקה?',
1304 'text'=>'רכב חדש - 0 ×§"מ, ×חריות יבו×ן רשמית, חבילת הטבות והסדר מימון ×טרקטיבי לבחירה של עד 100 תשלומי×'
1305 ),
1306 array(
1307 'title'=>'×”×× ×ž×—×™×¨ הרכב כולל ×גרת רישוי?',
1308 'text'=>'×גרת רישוי הקבועה בחוק ×ª×©×•×œ× ×‘× ×¤×¨×“ בעת רכישת הרכב והעברת הבעלות לידי הרוכש'
1309 ),
1310 array(
1311 'title'=>'מהו מחיר היבו×ן?',
1312 'text'=>'מחיר היבו×ן ×”×™× ×• מחיר קטלוגי לרכב חדש הכולל מע"מ ×•×¤×•×¨×¡× ×¢"×™ היבו×ן הרשמי לפי סוג הדג×. מידע על מחיר יבו×ן ×œ×¨×›×‘×™× ×©×•× ×™× × ×™×ª×Ÿ ×œ×ž×¦×•× ×‘"קטלוג ×¨×›×‘×™× ×—×“×©×™×" במחירון הרכב של יד2'
1313 ),
1314 array(
1315 'title'=>'×”×× ×”×¨×›×‘ × ×©×ר שלי בסוף התקופה?',
1316 'text'=>'כן, בדיוק כמו ×§× ×™×™×ª רכב חדש- הרכב בבעלותך בלבד '
1317 ),array(
1318 'title'=>'מה לגבי העברת בעלות?',
1319 'text'=>'העברת הבעלות מחברת ×”×œ×™×¡×™× ×’ ×ל ×©× ×”×¨×•×›×© ×ª×©×•×œ× ×‘× ×¤×¨×“ ×¢"×™ הרוכש בהת×× ×œ×ª×¢×¨×™×£ משרד התחבורה'
1320 ),array(
1321 'title'=>'×יך יכול להיות שיש ×”× ×—×•×ª ×›×לו?',
1322 'text'=>'חברות ×”×œ×™×¡×™× ×’ רוכשות ×¨×›×‘×™× ×‘×›×ž×•×™×•×ª גדולות וכך מקבלות ×”× ×—×” מהיבו×ן. ×¨×™×©×•× ×”×¨×›×‘ לרוכש מחברת ×”×œ×™×¡×™× ×’ כיד ×©× ×™×” מ×פשר למכור ×ותו כחדש "×ž×”× ×™×™×œ×•× ×™×" במחיר מוזל'
1323 ),
1324 array(
1325 'title'=>'×יזו ×חריות ×קבל על הרכב?',
1326 'text'=>'×”×חריות ×”×™× ×” ×חריות יבו×ן רשמית בהת×× ×œ×—×•×“×© העלייה לכביש'
1327 ),
1328 array(
1329 'title'=>'מה עלי לעשות לקר×ת ×יסוף הרכב?',
1330 'text'=>'להצטייד ×‘×¡× ×“×‘×™×¥ ולצ×ת לדרך! ××”... ×•×’× ×œ× ×œ×©×›×•×— לקחת ×ת קבלת ×ª×©×œ×•× ×¢×‘×•×¨ שריון הרכב :)'
1331 ),
1332 array(
1333 'title'=>'×œ× ×§×™×‘×œ×ª×™ ×ת פרטי העסקה בסמס/מייל- מה עלי לעשות?',
1334 'text'=>'× ×™×ª×Ÿ ליצור קשר ×¢× ×ž×•×§×“ שירות הלקוחות יד2 רכב חדש, ×שר ישמח לעזור ולשלוח לך ×ת פרטי העסקה'
1335 ),
1336 array(
1337 'title'=>'מה קורה ×× ×× ×™ מבטל רכישת הרכב ל×חר ×©×¨×™×•× ×•? ×”×× ×™×—×–×•×¨ למל××™?',
1338 'text'=>'×¢× ×©×¨×™×•×Ÿ הרכב, הרכב מוסר ממל××™ ×”×¨×›×‘×™× ×‘×תר. ×¢× ×‘×™×˜×•×œ העסקה, תעבור הודעה ×ל חברת ×”×œ×™×¡×™× ×’ שתבחר ×× ×œ×”×—×–×™×¨ ×ת הרכב ×ל המל××™ ייתכן מצב בו הרכב ×œ× ×™×—×–×•×¨ למל××™ בהת×× ×œ×©×™×§×•×œ×” של חברת ×”×œ×™×¡×™× ×’ בעלת הרכב'
1339 ),
1340 array(
1341 'title'=>'כיצד × ×§×‘×¢×™× ×ª× ××™ ההלוו××” למימון לרכב?',
1342 'text'=>'×ª× ××™ ההלוו××” למימון הרכב × ×§×‘×¢×™× ×¢×œ ידי חברת מימון ישיר ובכפוף ×œ×ª× ××™ החברה'
1343 ),
1344 array(
1345 'title'=>'למה צריך ×œ×©×œ× ×¢×‘×•×¨ שריון הרכב?',
1346 'text'=>'שריון הרכב ×ž×§× ×” לך בלעדיות על הרכב המבוקש, שימתין לך ×‘×ž×§×•× ×”×יסוף שבחרת'
1347 ),
1348 array(
1349 'title'=>'מתי ×ª×©×œ×•× ×”×ž×§×“×ž×” מתבצע?',
1350 'text'=>' ×ª×©×œ×•× ×”×ž×§×“×ž×” למימון הרכב יתבצע במגרש, ×¢× ×יסוף הרכב ×•×ž×©×•×œ× ×œ×—×‘×¨×ª ×”×œ×™×¡×™× ×’ המוסרת ×ת הרכב ובהת×× ×œ×ª× ××™ ההלוו××” מול מימון ישיר'
1351 ),
1352 array(
1353 'title'=>'למי ×× ×™ משל×?',
1354 'text'=>'×ª×©×œ×•× ×©×¨×™×•×Ÿ הרכב ×ž×©×•×œ× ×œ×™×“2 pay, ×ª×©×œ×•× ×”×ž×§×“×ž×”, ×× ×™×©× ×”, ×ž×©×•×œ× ×™×©×™×¨×•×ª לחברת ×”×œ×™×¡×™× ×’ ×•×”×ª×©×œ×•× ×‘×’×™×Ÿ המימון לרכב ×ž×©×•×œ× ×‘×”×ª×× ×œ×¤×¨×™×¡×ª ×”×ª×©×œ×•×ž×™× ×œ×—×‘×¨×ª מימון ישיר'
1355 ),
1356 array(
1357 'title'=>'×”×× ×¢×œ×™×™ להיות בטוח שפרטי ×”×שר××™ שלי × ×©××¨×™× ×—×¡×•×™×™×?',
1358 'text'=>'כן! ×”×תר משתמש ×‘×˜×›× ×•×œ×•×’×™×•×ª ×”×בטחה הטובות והמתקדמות ביותר, ששומרות על פרטייך ×”××™×©×™×™× ×—×¡×•×™×™×'
1359 ),
1360 array(
1361 'title'=>'מתי חל חיוב המסלול?',
1362 'text'=>'החיוב החודשי מתחיל ל×חר ×יסוף הרכב ובהת×× ×œ×ª× ××™ ההלוו××” ×©× ×§×‘×¢×• ×•× ×—×ª×ž×• מול מימון ישיר'
1363 ),
1364 array(
1365 'title'=>'מהי עמלת פתיחת תיק הלוו××”?',
1366 'text'=>'עמלת פתיחת התיק ×”×™× ×” בסך 500 ₪ עבור פתיחת תיק ההלוו××” ×©× ×§×‘×¢×” מול מימון ישיר ×•×ª×©×•×œ× ×‘×ž×’×¨×© ×ž×ž× ×• ×‘×—×¨×ª× ×œ×סוף ×ת הרכב'
1367 ),
1368 array(
1369 'title'=>'במידה ו×× ×™ רוצה ×œ×©× ×•×ª ×ת ×ª× ××™ ההלוו××” ×˜×¨× ×§×‘×œ×ª הרכב, מה עליי לעשות?',
1370 'text'=>'עליך ×œ×¤× ×•×ª ×ל מימון ישיר בטלפון 03-7215840'
1371 ),
1372 array(
1373 'title'=>'×”×× ×›×œ ×חד יכול לקבל הלוו×ת מימון?',
1374 'text'=>'ההלוו××” כפופה ×œ×ª× ××™ חברת מימון ישיר, המספקת ×ת ההלוו××” למימון הרכב'
1375 ),
1376 array(
1377 'title'=>'מה ×ומר הסימון "בתהליך מכירה"',
1378 'text'=>'הסימון מ×ותת ×›×™ הרכב במודעה × ×‘×—×¨ על ידי לקוח שהתחיל ×ת תהליך השריון שלו, ×¢× ×–×ת, עדיין × ×™×ª×Ÿ להתחיל בתהליך השריון על ×ותו הרכב במקביל ולבצע ×ת הרכישה- כל ×”×§×•×“× ×–×•×›×”. רכב ×©×œ× × ×™×ª×Ÿ לרכישה, מוסר מהמל××™ ב×תר'
1379 )
1380 )
1381 );
1382 }
1383
1384
1385 public function getHowDoesItWorkData(){
1386 return array(
1387 'title'=>'×יך ×–×” עובד?',
1388 'data'=>array(
1389 array(
1390 'class'=> 'search_car',
1391 'image'=>'/assets/desktop/ui/feeditem/new-vehicle/search car@2x.png',
1392 'title_0'=>'×הבה מחיפוש ר×שון',
1393 'title_1'=>'חיפוש רכב',
1394 'content'=>'תחילה ×ž×—×¤×©×™× ×ת הרכב החדש מתוך ×”×“×’×ž×™× ×”×ž×•×¦×¢×™×.
1395הרכב החדש ש××ª× ×‘×•×—×¨×™× ×™×”×™×” ×ותו הרכב שתקבלו, החל מהצבע שתפס ××ª×›× ×•×¢×“ רמת הגימור. '
1396 ),
1397 array(
1398 'class'=> 'maslul',
1399 'image'=>'/assets/desktop/ui/feeditem/new-vehicle/maslul@2x.png',
1400 'title_0'=>'פשוט ×œ×™×”× ×•×ª מהדרך',
1401 'title_1'=>'בחירת מסלול',
1402 'content'=>'××ª× ×ž×—×œ×™×˜×™× ×¢×œ מסלול פריסת ×”×ª×©×œ×•×ž×™× ×”× ×•×— ביותר עבורכ×, על ידי קביעת ×¡×›×•× ×”×ž×§×“×ž×”, מספר ×”×ª×©×œ×•×ž×™× ×•×”×”×—×–×¨ החודשי.
1403×ישור המסלול מתבצע מול מימון ישיר בלבד, כשה×ישור ×”×¢×§×¨×•× ×™ למסלול מתקבל ××•× ×œ×™×™×Ÿ. '),
1404 array(
1405 'class'=> 'reserved',
1406 'image'=>'/assets/desktop/ui/feeditem/new-vehicle/reserved@2x.png',
1407 'title_0'=>'כל ×”×§×•×“× ×–×•×›×”',
1408 'title_1'=>'שריון הרכב',
1409 'content'=>'
1410ל×חר קבלת ×ישור ×¢×§×¨×•× ×™ למימון, תתבקשו ×œ×©×œ× ×¢×‘×•×¨ שריון הרכב (1350 ₪) ×”×ž×§× ×” ×œ×›× ×‘×œ×¢×“×™×•×ª על הרכב שבחרת×.
1411הרכב ימתין ×œ×›× ×ª×•×š זמן קצר של 72 שעות בלבד, ×‘× ×§×•×“×ª ×”×יסוף שתבחרו.'),
1412 array(
1413 'class'=> 'new_car_keys',
1414 'image'=>'/assets/desktop/ui/feeditem/new-vehicle/new car keys@2x.png',
1415 'title_0'=>'×”×™×•× ×”×’×“×•×œ',
1416 'title_1'=>'×יסוף הרכב',
1417 'content'=>'×ž×’×™×¢×™× ×ל × ×§×•×“×ª ×”×יסוף ×©×‘×—×¨×ª× ×¢× ×¢×¥ ריח, ×ו כל דבר ×חר שעושה ×œ×›× ×˜×•×‘, ×ž×¡×™×™×ž×™× ×¢× ×”× ×™×™×¨×ª ויוצ××™× ×œ×“×¨×š חדשה.'),
1418
1419
1420 ));
1421 }
1422 public function getAboutData(){
1423 return array(
1424 'title'=>'מי ×× ×—× ×•',
1425 'data'=>array(
1426 array('type'=>'content','text'=>'יד2 מתרחבת ×œ×ª×—×•× ×”×›×™ ×—× ×‘×©×•×§ הרכב הישר×לי-רכב חדש, ×פס קילומטר.','text1' => 'יד2 מתרחבת ×œ×ª×—×•× ×”×›×™ ×—× ×‘×©×•×§ הרכב הישר×לי-','text2' => 'רכב חדש, ×פס קילומטר.'),
1427 array('type'=>'title','text'=>'×יך?'),
1428 array('type'=>'content','text'=>'××ª× × ×”× ×™× ×ž×©×™×ª×•×£ פעולה משולש, בו תרכשו רכב חדש (0 ×§"מ) "×ž×”× ×™×™×œ×•× ×™×" ב×תר יד2 מחברות ×”×œ×™×¡×™× ×’ המובילות בשוק, ב×מצעות מימון ישיר (מקבוצת ביטוח ישיר- החברה הוותיקה והמובילה בתחומה) במסלול שתבחרו וב×ספקה מהירה של 3 ימי ×¢×¡×§×™× ×‘×œ×‘×“! כל ×–×” קורה בלי שתצטרכו לצ×ת מהבית, בתהליך ×—×“×©× ×™ ומקוון ב-100%.קר××ª× × ×›×•×Ÿ, ×›-ל תהליך הרכישה מתבצע ב××™× ×˜×¨× ×˜. '),
1429 array('type'=>'title','text'=>'למה לי?'),
1430 array('type'=>'content','text'=>array(
1431 '<b>×ת×</b> ×‘×•×—×¨×™× ×ת הרכב ×©×œ×›× ×ž×ž×’×•×•×Ÿ ×”×™×¦×¨× ×™× ×•×”×“×’×ž×™× ×”×§×™×™×ž×™× ×‘×ž×œ××™ חברות ×”×œ×™×¡×™× ×’.',
1432 '<b>×ת×</b> ×ž×—×œ×™×˜×™× ×¢×œ מסלול המימון שמת××™× ×œ×›×, ×‘×ª× ××™× ×’×ž×™×©×™× ×•×ž×¦×•×™× ×™× ×‘×מצעות מימון ישיר בלבד (× ×›×•×Ÿ, ×œ× ×¦×¨×™×š להסתבך ×¢× ×”×‘× ×§).',
1433 '<b>×ת×</b> ×‘×•×—×¨×™× ×ת × ×§×•×“×ª ×”×יסוף בה ימתין ×œ×›× ×”×¨×›×‘ תוך 72 שעות (3 ימי עסקי×) בלבד.',
1434 '<b>×ת×</b> ×¨×•×›×©×™× ×ת הרכב ×‘×ž×§×•× ×•×–×ž×Ÿ שלכ×- התהליך ××™× ×˜×¨× ×˜×™ לחלוטין.',
1435 '<b>×× ×—× ×•</b> מ××¤×©×¨×™× ×œ×›× ×œ×‘×˜×œ ×ת העסקה בכל רגע × ×ª×•×Ÿ.'
1436 )),
1437 ));
1438 }
1439
1440 public function getExplainStepListData(){
1441
1442 $return = array(
1443 array('title'=>'חפשו רכב','image'=>'/assets/desktop/ui/feeditem/new-vehicle/search car.png','icon'=>'/assets/desktop/ui/feeditem/new-vehicle/grey600.png','class'=>'search_car','text'=>'תחילה ×ž×—×¤×©×™× ×ת הרכב החדש מתוך ×”×“×’×ž×™× ×”×ž×•×¦×¢×™×.
1444הרכב החדש ש××ª× ×‘×•×—×¨×™× ×™×”×™×” ×ותו הרכב שתקבלו, החל מהצבע שתפס ××ª×›× ×•×¢×“ רמת הגימור.'),
1445 array('title'=>'בחירת מסלול','image'=>'/assets/desktop/ui/feeditem/new-vehicle/maslul.png','icon'=>'/assets/desktop/ui/feeditem/new-vehicle/grey600.png','class'=>'maslul','text'=>'××ª× ×ž×—×œ×™×˜×™× ×¢×œ מסלול פריסת ×”×ª×©×œ×•×ž×™× ×”× ×•×— ביותר עבורכ×, על ידי קביעת ×¡×›×•× ×”×ž×§×“×ž×”, מספר ×”×ª×©×œ×•×ž×™× ×•×”×”×—×–×¨ החודשי.
1446×ישור המסלול מתבצע מול מימון ישיר בלבד, כשה×ישור ×”×¢×§×¨×•× ×™ למסלול מתקבל ××•× ×œ×™×™×Ÿ.'),
1447 array('title'=>'שריון רכב','image'=>'/assets/desktop/ui/feeditem/new-vehicle/reserved.png','icon'=>'/assets/desktop/ui/feeditem/new-vehicle/grey600.png','class'=>'reserved','text'=>'ל×חר קבלת ×ישור ×¢×§×¨×•× ×™ למימון, תתבקשו ×œ×©×œ× ×¢×‘×•×¨ שריון הרכב (1350 ₪) ×”×ž×§× ×” ×œ×›× ×‘×œ×¢×“×™×•×ª על הרכב שבחרת×.
1448הרכב ימתין ×œ×›× ×ª×•×š זמן קצר של 72 שעות בלבד, ×‘× ×§×•×“×ª ×”×יסוף שתבחרו.'),
1449 array('title'=>'×יסוף רכב','image'=>'/assets/desktop/ui/feeditem/new-vehicle/new car keys.png','icon'=>'/assets/desktop/ui/feeditem/new-vehicle/grey600.png','class'=>'new_car_keys','text'=>'×ž×’×™×¢×™× ×ל × ×§×•×“×ª ×”×יסוף ×©×‘×—×¨×ª× ×¢× ×¢×¥ ריח, ×ו כל דבר ×חר שעושה ×œ×›× ×˜×•×‘, ×ž×¡×™×™×ž×™× ×¢× ×”× ×™×™×¨×ª ויוצ××™× ×œ×“×¨×š חדשה.')
1450 );
1451
1452 return $return;
1453 }
1454 public function getExplainListData(){
1455
1456 $return = array(
1457 array('title1'=>'×ספקה תוך','title2'=>'3 ימי עסקי×','image'=>'/assets/desktop/ui/feeditem/new-vehicle/date icon.png','class'=>'date_icon'),
1458 array('title1'=>'מימון בפריסה','title2'=>'של עד 100 תשלומי×','image'=>'/assets/desktop/ui/feeditem/new-vehicle/logo mimun iashir1.png','class'=>'logo_mimun'),
1459 array('title1'=>'ביטול עסקה','title2'=>'×œ×œ× ×§× ×¡×•×ª!','image'=>'/assets/desktop/ui/feeditem/new-vehicle/bitul.png','class'=>'bitul'),
1460 array('title1'=>'רכב חדש','title2'=>'×ž×”× ×™×™×œ×•× ×™× "0 ×§"מ"','image'=>'/assets/desktop/ui/feeditem/new-vehicle/new car icon.png','class'=>'new_car_icon'),
1461 array('title1'=>'מחיר יד2','title2'=>'כולל ×גרת רישוי','image'=>'/assets/desktop/ui/feeditem/new-vehicle/stamp.png','class'=>'stamp'),
1462 array('title1'=>'×חריות','title2'=>'יבו×ן רשמית','image'=>'/assets/desktop/ui/feeditem/new-vehicle/safe icon.png','class'=>'safe_icon')
1463 );
1464
1465 return $return;
1466 }
1467
1468
1469}