....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 107.180.102.13  /  Your IP : 216.73.216.127
Web Server : Apache
System : Linux ip-107-180-102-13.ip.secureserver.net 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64
User : nobody ( 99)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/egdeals/public_html/catalog/controller/extension/onepagecheckout/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/egdeals/public_html/catalog/controller/extension/onepagecheckout/validate.php
<?php
class ControllerextensionOnepagecheckoutValidate extends Controller {
	private $ssl = 'SSL';
	private $requireds = array();
	private $prequireds = array();
	private $drequireds = array();
	
	public function __construct($registry){
		parent::__construct( $registry );
		$this->ssl = (defined('VERSION') && version_compare(VERSION,'2.2.0.0','>=')) ? true : 'SSL';
	}
	
	private function setPersonalRequiredFeilds(){
		$this->load->model('setting/setting');
		$onepagecheckout_info = $this->model_setting_setting->getSetting('onepagecheckout', $this->config->get('config_store_id'));
		
		$onepagecheckout_manage = (!empty($onepagecheckout_info['onepagecheckout_manage'])) ? $onepagecheckout_info['onepagecheckout_manage'] : array();
		
		$fields	= (isset($onepagecheckout_manage['personaldetails']['fields']) ? $onepagecheckout_manage['personaldetails']['fields'] : array());
		
		foreach($fields as $key => $feild){
			$required = false;
			switch($feild['show']) {
				case 2:
				$required = true;
				break;
			}
			
			if($required){
				$this->requireds[$key] = array(
					'required'	=> $required,
					'errormsg'	=> $onepagecheckout_manage['register'][$key]['error'][$this->config->get('config_language_id')],
				);
			}
		}
	}
	
	private function setPaymentRequiredFeilds(){
		$this->load->model('setting/setting');
		$onepagecheckout_info = $this->model_setting_setting->getSetting('onepagecheckout', $this->config->get('config_store_id'));
		
		$onepagecheckout_manage = (!empty($onepagecheckout_info['onepagecheckout_manage'])) ? $onepagecheckout_info['onepagecheckout_manage'] : array();
		
		$fields	= (isset($onepagecheckout_manage['payment_details']['fields']) ? $onepagecheckout_manage['payment_details']['fields'] : array());
		
		foreach($fields as $key => $feild){
			$required = false;
			switch($feild['show']) {
				case 2:
				$required = true;
				break;
			}
			
			if($required){
				$this->prequireds[$key] = array(
					'required'	=> $required,
					'errormsg'	=> $onepagecheckout_manage['payment_details_language'][$key]['error'][$this->config->get('config_language_id')],
				);
			}
		}
	}
	
	private function setDeliveryRequiredFeilds(){
		$this->load->model('setting/setting');
		$onepagecheckout_info = $this->model_setting_setting->getSetting('onepagecheckout', $this->config->get('config_store_id'));
		
		$onepagecheckout_manage = (!empty($onepagecheckout_info['onepagecheckout_manage'])) ? $onepagecheckout_info['onepagecheckout_manage'] : array();
		
		$fields	= (isset($onepagecheckout_manage['delivery']['fields']) ? $onepagecheckout_manage['delivery']['fields'] : array());
		
		
		foreach($fields as $key => $feild){
			$required = false;
			switch($feild['show']) {
				case 2:
				$required = true;
				break;
			}
			
			if($required){
				$this->drequireds[$key] = array(
					'required'	=> $required,
					'errormsg'	=> $onepagecheckout_manage['delivery_detail'][$key]['error'][$this->config->get('config_language_id')],
				);
			}
		}
	}
	
	public function validateForm(){
		$json = array();
		$onepagecheckout_manage = $this->config->get('onepagecheckout_manage');
		$this->load->language('extension/onepagecheckout/checkout');
		
		$this->load->model('account/customer');
		if(!$this->customer->isLogged()){
			$this->setPersonalRequiredFeilds();
			// Register Or Guest Checkout - Personal Details (Validate)
			if(!empty($this->request->post['account_type']) && ($this->request->post['account_type'] == 'register' || $this->request->post['account_type'] == 'guest')){
				foreach($this->requireds as $key => $required){
					if($key == 'firstname') {
						if ((utf8_strlen(trim($this->request->post['personal_details']['firstname'])) < 1) || (utf8_strlen(trim($this->request->post['personal_details']['firstname'])) > 32)) {
							$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_firstname');
						}
					}
					
					if($key == 'lastname'){
						if ((utf8_strlen(trim($this->request->post['personal_details']['lastname'])) < 1) || (utf8_strlen(trim($this->request->post['personal_details']['lastname'])) > 32)) {
							$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_lastname');
						}
					}
					
					if($key == 'email') {
						if ((utf8_strlen($this->request->post['personal_details']['email']) > 96) || !filter_var($this->request->post['personal_details']['email'], FILTER_VALIDATE_EMAIL)) {
							$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_email');
						}
						
						if(!empty($this->request->post['account_type']) && $this->request->post['account_type'] == 'register') {
							if ($this->model_account_customer->getTotalCustomersByEmail($this->request->post['personal_details']['email'])) {
								$json['error']['warning'] = $this->language->get('error_exists');
								$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_email');
							}
						}
					}
					
					if($key == 'company') {
						if(empty($this->request->post['personal_details']['company'])) {
							$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_company');
						}
					}
					
					if($key == 'telephone') {
						if ((utf8_strlen($this->request->post['personal_details']['telephone']) < 3) || (utf8_strlen($this->request->post['personal_details']['telephone']) > 32)) {
							$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_telephone');
						}
					}
					
					if($key == 'address_1') {
						if ((utf8_strlen($this->request->post['personal_details']['address_1']) < 3) || (utf8_strlen($this->request->post['personal_details']['address_1']) > 128)) {
							$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_address_1');
						}
					}
					
					if($key == 'address_2') {
						if ((utf8_strlen($this->request->post['personal_details']['address_2']) < 3) || (utf8_strlen($this->request->post['personal_details']['address_2']) > 32)) {
							$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_address_2');
						}
					}
					
					if($key == 'city') {
						if ((utf8_strlen($this->request->post['personal_details']['city']) < 2) || (utf8_strlen($this->request->post['personal_details']['city']) > 128)) {
							$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_city');
						}
					}
					
					if($key == 'postcode') {
						if ((utf8_strlen($this->request->post['personal_details']['postcode']) < 2) || (utf8_strlen($this->request->post['personal_details']['postcode']) > 10)) {
							$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_postcode');
						}
					}
					
					if($key == 'fax') {
						if(empty($this->request->post['personal_details']['fax'])) {
							$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_fax');
						}
					}
					
					if($key == 'country') {
						$this->load->model('localisation/country');
						$country_info = $this->model_localisation_country->getCountry($this->request->post['personal_details']['country_id']);
						if ($this->request->post['personal_details']['country_id'] == '') {
							$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_country');
						}
					}
					
					if($key == 'zone') {
						if (!isset($this->request->post['personal_details']['zone_id']) || $this->request->post['personal_details']['zone_id'] == '' || !is_numeric($this->request->post['personal_details']['zone_id'])) {
							$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_zone');
						}
					}
					
					if(!empty($this->request->post['account_type']) && $this->request->post['account_type'] == 'register') {
						if($key == 'password') {
							if ((utf8_strlen($this->request->post['personal_details']['password']) < 4) || (utf8_strlen($this->request->post['personal_details']['password']) > 20)) {
								$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_password');
							}
						}
						
						if($key == 'confirm') {
							if ($this->request->post['personal_details']['confirm'] != $this->request->post['personal_details']['password']) {
								$json['error']['personal_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_confirm');
							}
						}
					}
				}
				
				$captcha_status = (!empty($onepagecheckout_manage['personaldetails']['captcha_status']) ? $onepagecheckout_manage['personaldetails']['captcha_status'] : '');
				if ($this->config->get('captcha_' . $this->config->get('config_captcha') . '_status') && $captcha_status){
					$captcha = $this->load->controller('extension/captcha/' . $this->config->get('config_captcha') . '/validate');

					if ($captcha) {
						$json['error']['personal_details']['captcha'] = $captcha;
					}
				}
				
				
				// Customer Group
				if (isset($this->request->post['personal_details']['customer_group_id']) && is_array($this->config->get('onepagecheckout_customer_group_display')) && in_array($this->request->post['personal_details']['customer_group_id'], $this->config->get('onepagecheckout_customer_group_display'))) {
					$customer_group_id = $this->request->post['personal_details']['customer_group_id'];
				} else {
					$customer_group_id = $this->config->get('onepagecheckout_customer_group_id');
				}

				// Custom field validation
				$this->load->model('account/custom_field');

				$custom_fields = $this->model_account_custom_field->getCustomFields($customer_group_id);

				foreach ($custom_fields as $custom_field) {
					if ($custom_field['required'] && empty($this->request->post['personal_details']['custom_field'][$custom_field['location']][$custom_field['custom_field_id']])) {
						$json['error']['personal_details']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
					} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation'])) && !filter_var($this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
						$json['error']['personal_details']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field_validate'), $custom_field['name']);
					}
				}
			}
			
			// Delivery Address (Validate)
			
			if(!empty($onepagecheckout_manage['delivery']['delivery_status'])){
				$data['delivery_status'] = $onepagecheckout_manage['delivery']['delivery_status'];
			}else{
				$data['delivery_status'] = false;
			}
		
			if ($this->cart->hasShipping() && $data['delivery_status']){
				if(empty($this->request->post['personal_details']['shipping_address'])){
					$this->setDeliveryRequiredFeilds();
					foreach($this->drequireds as $key => $required){
						if($key == 'firstname') {
							if ((utf8_strlen(trim($this->request->post['delivery_details']['firstname'])) < 1) || (utf8_strlen(trim($this->request->post['delivery_details']['firstname'])) > 32)) {
								$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_firstname');
							}
						}
						
						if($key == 'lastname') {
							if ((utf8_strlen(trim($this->request->post['delivery_details']['lastname'])) < 1) || (utf8_strlen(trim($this->request->post['delivery_details']['lastname'])) > 32)) {
								$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_lastname');
							}
						}
						
						if($key == 'company') {
							if(empty($this->request->post['delivery_details']['company'])) {
								$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_company');
							}
						}
						
						
						if($key == 'address_1') {
							if ((utf8_strlen($this->request->post['delivery_details']['address_1']) < 3) || (utf8_strlen($this->request->post['delivery_details']['address_1']) > 128)) {
								$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_address_1');
							}
						}
						
						if($key == 'address_2') {
							if ((utf8_strlen($this->request->post['delivery_details']['address_2']) < 3) || (utf8_strlen($this->request->post['delivery_details']['address_2']) > 32)) {
								$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_address_2');
							}
						}
						
						if($key == 'city') {
							if ((utf8_strlen($this->request->post['delivery_details']['city']) < 2) || (utf8_strlen($this->request->post['delivery_details']['city']) > 128)) {
								$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_city');
							}
						}
						
						if($key == 'postcode') {
							if ((utf8_strlen($this->request->post['delivery_details']['postcode']) < 2) || (utf8_strlen($this->request->post['delivery_details']['postcode']) > 10)) {
								$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_postcode');
							}
						}
						
						if($key == 'country') {
							$this->load->model('localisation/country');
							$country_info = $this->model_localisation_country->getCountry($this->request->post['delivery_details']['country_id']);
							if ($this->request->post['delivery_details']['country_id'] == '') {
								$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_country');
							}
						}
						
						if($key == 'zone') {
							if (!isset($this->request->post['delivery_details']['zone_id']) || $this->request->post['delivery_details']['zone_id'] == '' || !is_numeric($this->request->post['delivery_details']['zone_id'])) {
								$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_zone');
							}
						}
					}
					
					// Customer Group
					if (isset($this->request->post['personal_details']['customer_group_id']) && is_array($this->config->get('onepagecheckout_customer_group_display')) && in_array($this->request->post['personal_details']['customer_group_id'], $this->config->get('onepagecheckout_customer_group_display'))) {
						$customer_group_id = $this->request->post['personal_details']['customer_group_id'];
					} else {
						$customer_group_id = $this->config->get('onepagecheckout_customer_group_id');
					}

					// Custom field validation
					$this->load->model('account/custom_field');

					$custom_fields = $this->model_account_custom_field->getCustomFields($customer_group_id);

					foreach ($custom_fields as $custom_field) {
						if (($custom_field['location'] == 'address') && $custom_field['required'] && empty($this->request->post['delivery_details']['custom_field'][$custom_field['custom_field_id']])) {
							$json['error']['delivery_details']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
						} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation']) && $custom_field['location'] == 'address') && !filter_var($this->request->post['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
							$json['error']['delivery_details']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field_validate'), $custom_field['name']);
						}
					}
				}
			}
			
			$require_comment_status = $this->config->get('onepagecheckout_manage'); 
			
			if(!empty($require_comment_status['confirm_order']['terms'])){
					$this->load->model('catalog/information');

					$information_info = $this->model_catalog_information->getInformation($require_comment_status['confirm_order']['terms']);

					if ($information_info && !isset($this->request->post['agree'])) {
						$json['error']['warning'] = sprintf($this->language->get('error_agree'), $information_info['title']);
					}
			}
			
			if(!empty($require_comment_status['personaldetails']['terms'])){
					$this->load->model('catalog/information');

					$information_info = $this->model_catalog_information->getInformation($require_comment_status['personaldetails']['terms']);

					if ($information_info && !isset($this->request->post['personal_details']['agree'])) {
						$json['error']['warning'] = sprintf($this->language->get('error_agree'), $information_info['title']);
					}
			}
			
			if (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout')) {
				
				$json['error']['warning'] = $this->language->get('error_stock');
			}
			
			if ($this->cart->hasShipping()){
				if(!isset($this->request->post['shipping_method'])) {
						$json['error']['shipping_method']['warning'] = $this->language->get('error_shipping');
				}else{
					$shipping = explode('.', $this->request->post['shipping_method']);
					if (!isset($shipping[0]) || !isset($shipping[1]) || !isset($this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {
							$json['error']['shipping_method']['warning'] = $this->language->get('error_shipping');
					}
				}
			}
			
			if(!isset($this->request->post['payment_method'])){
					$json['error']['payment_method']['warning'] = $this->language->get('error_payment');
			} elseif (!isset($this->session->data['payment_methods'][$this->request->post['payment_method']])) {
				$json['error']['payment_method']['warning'] = $this->language->get('error_payment');
			}
			
			
			if(!empty($require_comment_status['confirm_order']['require_comment_status']) && $require_comment_status['confirm_order']['comment_status']){
				if(empty($this->request->post['comment'])){
					$json['error']['comment'] = (!empty($require_comment_status['confirm_order']['comment_error'][$this->config->get('config_language_id')]) ? $require_comment_status['confirm_order']['comment_error'][$this->config->get('config_language_id')] : $this->language->get('text_comment'));
				}
			}
			
			if(empty($this->request->post['delivery_date']) && $this->config->get('onepagecheckout_delivery_required') && $this->config->get('onepagecheckout_delivery_status')){
				$json['error']['delivery_date'] = (!empty($require_comment_status['delivery']['required'][$this->config->get('config_language_id')]) ? $require_comment_status['delivery']['required'][$this->config->get('config_language_id')] : 'Required Delivery');
			}
			
			//comment_error
			if(!$json){
				$json = $this->save($this->request->post,$customer_group_id);
				$this->session->data['comment'] = (isset($this->request->post['comment']) ? $this->request->post['comment'] : '');
				$this->session->data['delivery_date'] = (isset($this->request->post['delivery_date']) ? $this->request->post['delivery_date'] : '');
				$this->session->data['agree'] = (isset($this->request->post['agree']) ? $this->request->post['agree'] : '');
			}
		}else{
			if(isset($this->request->post['personal_details'])){
				$json['redirect'] = true;
			}else{
			/*PAYMENT ADDRESS START*/
			if(isset($this->request->post['payment_details'])){
				$this->setPaymentRequiredFeilds();
				
				/*XML START*/
				$require_comment_status = $this->config->get('onepagecheckout_manage'); 
			
				if(!empty($require_comment_status['confirm_order']['terms'])){
						$this->load->model('catalog/information');

						$information_info = $this->model_catalog_information->getInformation($require_comment_status['confirm_order']['terms']);

						if ($information_info && !isset($this->request->post['agree'])) {
							$json['error']['warning'] = sprintf($this->language->get('error_agree'), $information_info['title']);
						}
				}
				
				if(!empty($require_comment_status['confirm_order']['require_comment_status']) && $require_comment_status['confirm_order']['comment_status']){
					if(empty($this->request->post['comment'])){
						$json['error']['comment'] = (!empty($require_comment_status['confirm_order']['comment_error'][$this->config->get('config_language_id')]) ? $require_comment_status['confirm_order']['comment_error'][$this->config->get('config_language_id')] : $this->language->get('text_comment'));
					}
				}
				
				if(empty($this->request->post['delivery_date']) && $this->config->get('onepagecheckout_delivery_required') && $this->config->get('onepagecheckout_delivery_status')){
					$json['error']['delivery_date'] = (!empty($require_comment_status['delivery']['required'][$this->config->get('config_language_id')]) ? $require_comment_status['delivery']['required'][$this->config->get('config_language_id')] : 'Required Delivery');
				}
				/*XML END*/
				
				
				if($this->request->post['payment_details']['payment_address']=='new'){
					$this->load->model('account/address');
						foreach($this->prequireds as $key => $required){
							if($key == 'firstname'){
								if ((utf8_strlen(trim($this->request->post['payment_details']['firstname'])) < 1) || (utf8_strlen(trim($this->request->post['payment_details']['firstname'])) > 32)) {
									$json['error']['payment_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_firstname');
								}
							}
							
							if($key == 'lastname'){
								if ((utf8_strlen(trim($this->request->post['payment_details']['lastname'])) < 1) || (utf8_strlen(trim($this->request->post['payment_details']['lastname'])) > 32)) {
									$json['error']['payment_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_lastname');
								}
							}
							
							if($key == 'company'){
								if(empty($this->request->post['payment_details']['company'])) {
									$json['error']['payment_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_company');
								}
							}
							
							if($key == 'address_1'){
								if ((utf8_strlen($this->request->post['payment_details']['address_1']) < 3) || (utf8_strlen($this->request->post['payment_details']['address_1']) > 128)) {
									$json['error']['payment_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_address_1');
								}
							}
							
							if($key == 'address_2') {
								if ((utf8_strlen($this->request->post['payment_details']['address_2']) < 3) || (utf8_strlen($this->request->post['payment_details']['address_2']) > 32)) {
									$json['error']['payment_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_address_2');
								}
							}
							
							if($key == 'city') {
								if ((utf8_strlen($this->request->post['payment_details']['city']) < 2) || (utf8_strlen($this->request->post['payment_details']['city']) > 128)) {
									$json['error']['payment_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_city');
								}
							}
							
							if($key == 'postcode') {
								if ((utf8_strlen($this->request->post['payment_details']['postcode']) < 2) || (utf8_strlen($this->request->post['payment_details']['postcode']) > 10)) {
									$json['error']['payment_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_postcode');
								}
							}
							
							if($key == 'country') {
								$this->load->model('localisation/country');
								$country_info = $this->model_localisation_country->getCountry($this->request->post['payment_details']['country_id']);
								if ($this->request->post['payment_details']['country_id'] == '') {
									$json['error']['payment_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_country');
								}
							}
							
							if($key == 'zone') {
								if (!isset($this->request->post['payment_details']['zone_id']) || $this->request->post['payment_details']['zone_id'] == '' || !is_numeric($this->request->post['payment_details']['zone_id'])) {
									$json['error']['payment_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_zone');
								}
							}
						}
						
						// Custom field validation
						$this->load->model('account/custom_field');

						$custom_fields = $this->model_account_custom_field->getCustomFields($this->config->get('config_customer_group_id'));

						foreach ($custom_fields as $custom_field) {
							if (($custom_field['location'] == 'address') && $custom_field['required'] && empty($this->request->post['payment_details']['custom_field'][$custom_field['custom_field_id']])) {
								$json['error']['payment_details']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
							} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation']) && $custom_field['location'] == 'address') && !filter_var($this->request->post['payment_details']['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
								$json['error']['payment_details']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field_validate'), $custom_field['name']);
							}
						}
					 
					 //Vaildate Payment Method
					 if (!isset($this->request->post['payment_method'])) {
						$json['error']['payment_method']['warning'] = $this->language->get('error_payment');
					 } elseif (!isset($this->session->data['payment_methods'][$this->request->post['payment_method']])) {
						$json['error']['payment_method']['warning'] = $this->language->get('error_payment');
					 }

					if(!$json){
						if(!empty($onepagecheckout_manage['delivery']['delivery_status'])){
							$data['delivery_status'] = $onepagecheckout_manage['delivery']['delivery_status'];
						}else{
							$data['delivery_status'] = false;
						}
			
						 // Default Payment Address
						$this->load->model('account/address');
					
						$this->load->model('extension/onepagecheckout/customer');

						$address_id = $this->model_extension_onepagecheckout_customer->addAddress($this->request->post['payment_details']);

						$this->session->data['payment_address'] = $this->model_account_address->getAddress($address_id);
						
						
						
						if(!$data['delivery_status']){
							$this->session->data['shipping_address'] = $this->model_account_address->getAddress($address_id);
						}
						
						if(!empty($this->request->post['payment_details']['shipping_address'])){
							$this->session->data['shipping_address'] = $this->model_account_address->getAddress($address_id);
						}

						$this->load->model('account/activity');

						$activity_data = array(
							'customer_id' => $this->customer->getId(),
							'name'        => $this->customer->getFirstName() . ' ' . $this->customer->getLastName()
						);

						$this->model_account_activity->addActivity('address_add', $activity_data);
					}
				}
			}
			/*PAYMENT ADDRESS END*/
			/*Delivery ADDRESS START*/
			if ($this->cart->hasShipping()){
				if(isset($this->request->post['delivery_details']) && !isset($this->request->post['payment_details']['shipping_address'])){
					$this->setDeliveryRequiredFeilds();
					if($this->request->post['delivery_details']['shipping_address']=='new'){
						foreach($this->drequireds as $key => $required){
							if($key == 'firstname'){
								if ((utf8_strlen(trim($this->request->post['delivery_details']['firstname'])) < 1) || (utf8_strlen(trim($this->request->post['delivery_details']['firstname'])) > 32)) {
									$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_firstname');
								}
							}
							
							if($key == 'lastname') {
								if ((utf8_strlen(trim($this->request->post['delivery_details']['lastname'])) < 1) || (utf8_strlen(trim($this->request->post['delivery_details']['lastname'])) > 32)) {
									$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_lastname');
								}
							}
							
							if($key == 'company') {
								if(empty($this->request->post['delivery_details']['company'])) {
									$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_company');
								}
							}
							
							
							if($key == 'address_1') {
								if ((utf8_strlen($this->request->post['delivery_details']['address_1']) < 3) || (utf8_strlen($this->request->post['delivery_details']['address_1']) > 128)) {
									$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_address_1');
								}
							}
							
							if($key == 'address_2') {
								if ((utf8_strlen($this->request->post['delivery_details']['address_2']) < 3) || (utf8_strlen($this->request->post['delivery_details']['address_2']) > 32)) {
									$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_address_2');
								}
							}
							
							if($key == 'city') {
								if ((utf8_strlen($this->request->post['delivery_details']['city']) < 2) || (utf8_strlen($this->request->post['delivery_details']['city']) > 128)) {
									$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_city');
								}
							}
							
							if($key == 'postcode') {
								if ((utf8_strlen($this->request->post['delivery_details']['postcode']) < 2) || (utf8_strlen($this->request->post['delivery_details']['postcode']) > 10)) {
									$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_postcode');
								}
							}
							
							if($key == 'country') {
								$this->load->model('localisation/country');
								$country_info = $this->model_localisation_country->getCountry($this->request->post['delivery_details']['country_id']);
								if ($this->request->post['delivery_details']['country_id'] == '') {
									$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_country');
								}
							}
							
							if($key == 'zone') {
								if (!isset($this->request->post['delivery_details']['zone_id']) || $this->request->post['delivery_details']['zone_id'] == '' || !is_numeric($this->request->post['delivery_details']['zone_id'])) {
									$json['error']['delivery_details'][$key] = (!empty($required['errormsg'])) ? $required['errormsg'] : $this->language->get('error_zone');
								}
							}
						}
							
						
						$this->load->model('account/custom_field');
						$custom_fields = $this->model_account_custom_field->getCustomFields($this->config->get('config_customer_group_id'));
						foreach($custom_fields as $custom_field){
							if (($custom_field['location'] == 'address') && $custom_field['required'] && empty($this->request->post['delivery_details']['custom_field'][$custom_field['custom_field_id']])) {
								$json['error']['delivery_details']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);
							} elseif (($custom_field['type'] == 'text' && !empty($custom_field['validation']) && $custom_field['location'] == 'address') && !filter_var($this->request->post['delivery_details']['custom_field'][$custom_field['custom_field_id']], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => $custom_field['validation'])))) {
								$json['error']['delivery_details']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field_validate'), $custom_field['name']);
							}
						}
						 
						 //Vaildate Shipping Method
						if (!isset($this->request->post['shipping_method'])){
							$json['error']['shipping_method']['warning'] = $this->language->get('error_shipping');
						} else {
							$shipping = explode('.', $this->request->post['shipping_method']);

							if (!isset($shipping[0]) || !isset($shipping[1]) || !isset($this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {
								$json['error']['shipping_method']['warning'] = $this->language->get('error_shipping');
							}
						}
						
						if (!$json) {
							 // Default Payment Address
							$this->load->model('account/address');

							$this->load->model('extension/onepagecheckout/customer');

							$address_id = $this->model_extension_onepagecheckout_customer->addAddress($this->request->post['delivery_details']);

							$this->session->data['shipping_address'] = $this->model_account_address->getAddress($address_id);

							$this->load->model('account/activity');

							$activity_data = array(
								'customer_id' => $this->customer->getId(),
								'name'        => $this->customer->getFirstName() . ' ' . $this->customer->getLastName()
							);

							$this->model_account_activity->addActivity('address_add', $activity_data);
						}
					}
				}
			}
			
			
			if(!isset($json['error'])){
				$json['success'] = 'confirm';
			}
		
			$this->session->data['comment'] = (isset($this->request->post['comment']) ? $this->request->post['comment'] : '');
			
			$this->session->data['delivery_date'] = (isset($this->request->post['delivery_date']) ? $this->request->post['delivery_date'] : '');
			
			$this->session->data['agree'] = (isset($this->request->post['agree']) ? $this->request->post['agree'] : '');
			/*Delivery ADDRESS END*/
			}
		}
		
		if(isset($json['error']) && !isset($json['error']['warning'])){
			$json['error']['warning'] = (isset($onepagecheckout_manage['general']['warning'][$this->config->get('config_language_id')]) ? $onepagecheckout_manage['general']['warning'][$this->config->get('config_language_id')] : 'Warning: Please check the form carefully for errors!');
		}
		
		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput(json_encode($json));
	}
	
	public function save($data,$customer_group_id){
		$this->load->model('extension/onepagecheckout/customer');
		$json=array();
		// Validate if customer is already logged out.
		if($this->customer->isLogged()){
			$json['redirect'] = $this->url->link('checkout/checkout', '', true);
		}

		if($data['account_type']=='register'){
			if(isset($this->session->data['guest'])){
				unset($this->session->data['guest']);
			}
			
			$randomString='';
			if(!isset($data['personal_details']['password'])){
				$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
				$charactersLength = strlen($characters);
				$randomString = '';
				for ($i = 0; $i < 8; $i++){
					$randomString .= $characters[rand(0, $charactersLength - 1)];
				}
				
				$data['personal_details']['password'] = $randomString;
			}
			
			$customer_id = $this->model_extension_onepagecheckout_customer->addCustomer($data['personal_details']);
			$this->model_account_customer->deleteLoginAttempts($data['personal_details']['email']);
			$this->session->data['account'] = 'register';
			$this->load->model('account/customer_group');
			$customer_group_info = $this->model_account_customer_group->getCustomerGroup($customer_group_id);

			if ($customer_group_info && !$customer_group_info['approval']) {
				$this->customer->login($data['personal_details']['email'], $data['personal_details']['password']);

				// Default Payment Address
				$this->load->model('account/address');

				$this->session->data['payment_address'] = $this->model_account_address->getAddress($this->customer->getAddressId());
				if ($this->cart->hasShipping()){
					if (!empty($data['personal_details']['shipping_address'])){
						$this->session->data['shipping_address'] = $this->model_account_address->getAddress($this->customer->getAddressId());
					}else{
						$this->load->model('extension/onepagecheckout/customer');
						$address_id = $this->model_extension_onepagecheckout_customer->addAddress($data['delivery_details']);
						$this->session->data['shipping_address'] = $this->model_account_address->getAddress($address_id);
					}
				}
				$json['success'] = 'register';
			} else {
				$json['redirect'] = $this->url->link('account/success');
			}
		}
		
		//Guest
		if($data['account_type']=='guest'){
				$this->session->data['account'] = 'guest';

				$this->session->data['guest']['customer_group_id'] = $customer_group_id;
				$this->session->data['guest']['firstname'] = (isset($data['personal_details']['firstname']) ? $data['personal_details']['firstname'] : '');
				$this->session->data['guest']['lastname'] = (isset($data['personal_details']['lastname']) ? $data['personal_details']['lastname'] : '');
				$this->session->data['guest']['email'] = (isset($data['personal_details']['email']) ? $data['personal_details']['email'] : '');
				$this->session->data['guest']['telephone'] = (isset($data['personal_details']['telephone']) ? $data['personal_details']['telephone'] : '');
				$this->session->data['guest']['fax'] = (isset($data['personal_details']['fax']) ? $data['personal_details']['fax'] : '');

				if (isset($data['personal_details']['custom_field']['account'])) {
					$this->session->data['guest']['custom_field'] = $data['personal_details']['custom_field']['account'];
				} else {
					$this->session->data['guest']['custom_field'] = array();
				}

				$this->session->data['payment_address']['firstname']  = (isset($data['personal_details']['firstname']) ? $data['personal_details']['firstname'] : '');
				$this->session->data['payment_address']['lastname']   = (isset($data['personal_details']['lastname']) ? $data['personal_details']['lastname'] : '');
				$this->session->data['payment_address']['company']    = (isset($data['personal_details']['company']) ? $data['personal_details']['company'] : '');
				$this->session->data['payment_address']['address_1']  = (isset($data['personal_details']['address_1']) ? $data['personal_details']['address_1'] : '');
				$this->session->data['payment_address']['address_2']  = (isset($data['personal_details']['address_2']) ? $data['personal_details']['address_2'] : '');
				$this->session->data['payment_address']['postcode']   = (isset($data['personal_details']['postcode']) ? $data['personal_details']['postcode'] : '');
				$this->session->data['payment_address']['city'] 		  = (isset($data['personal_details']['city']) ? $data['personal_details']['city'] : '');
				$this->session->data['payment_address']['country_id'] = (isset($data['personal_details']['country_id']) ? $data['personal_details']['country_id'] : 0);
				$this->session->data['payment_address']['zone_id'] 	  = (isset($data['personal_details']['zone_id']) ? $data['personal_details']['zone_id'] : 0);

				$this->load->model('localisation/country');

				$country_info = $this->model_localisation_country->getCountry((isset($data['personal_details']['country_id']) ? $data['personal_details']['country_id'] : 0));

				if ($country_info) {
					$this->session->data['payment_address']['country'] = $country_info['name'];
					$this->session->data['payment_address']['iso_code_2'] = $country_info['iso_code_2'];
					$this->session->data['payment_address']['iso_code_3'] = $country_info['iso_code_3'];
					$this->session->data['payment_address']['address_format'] = $country_info['address_format'];
				} else {
					$this->session->data['payment_address']['country'] = '';
					$this->session->data['payment_address']['iso_code_2'] = '';
					$this->session->data['payment_address']['iso_code_3'] = '';
					$this->session->data['payment_address']['address_format'] = '';
				}

				if (isset($data['personal_details']['custom_field']['address'])) {
					$this->session->data['payment_address']['custom_field'] = $data['personal_details']['custom_field']['address'];
				} else {
					$this->session->data['payment_address']['custom_field'] = array();
				}

				$this->load->model('localisation/zone');

				$zone_info = $this->model_localisation_zone->getZone($data['personal_details']['zone_id']);

				if ($zone_info) {
					$this->session->data['payment_address']['zone'] = $zone_info['name'];
					$this->session->data['payment_address']['zone_code'] = $zone_info['code'];
				} else {
					$this->session->data['payment_address']['zone'] = '';
					$this->session->data['payment_address']['zone_code'] = '';
				}

				if (!empty($data['personal_details']['shipping_address'])) {
					$this->session->data['guest']['shipping_address'] = $data['personal_details']['shipping_address'];
				} else {
					$this->session->data['guest']['shipping_address'] = false;
				}
				
				if ($this->cart->hasShipping()){
					if ($this->session->data['guest']['shipping_address']) {
						$this->session->data['shipping_address']['firstname'] = (isset($data['personal_details']['firstname']) ? $data['personal_details']['firstname'] : '');
						$this->session->data['shipping_address']['lastname'] = (isset($data['personal_details']['lastname']) ? $data['personal_details']['lastname'] : '');
						$this->session->data['shipping_address']['company'] = (isset($data['personal_details']['company']) ? $data['personal_details']['company'] : '');
						$this->session->data['shipping_address']['address_1'] = (isset($data['personal_details']['address_1']) ? $data['personal_details']['address_1'] : '');
						$this->session->data['shipping_address']['address_2'] = (isset($data['personal_details']['address_2']) ? $data['personal_details']['address_2'] : '');
						$this->session->data['shipping_address']['postcode'] = (isset($data['personal_details']['postcode']) ? $data['personal_details']['postcode'] : '');
						$this->session->data['shipping_address']['city'] = (isset($data['personal_details']['city']) ? $data['personal_details']['city'] : '');
						$this->session->data['shipping_address']['country_id'] = (isset($data['personal_details']['country_id']) ? $data['personal_details']['country_id'] : '');
						$this->session->data['shipping_address']['zone_id'] = (isset($data['personal_details']['zone_id']) ? $data['personal_details']['zone_id'] : '');

						if ($country_info) {
							$this->session->data['shipping_address']['country'] = $country_info['name'];
							$this->session->data['shipping_address']['iso_code_2'] = $country_info['iso_code_2'];
							$this->session->data['shipping_address']['iso_code_3'] = $country_info['iso_code_3'];
							$this->session->data['shipping_address']['address_format'] = $country_info['address_format'];
						} else {
							$this->session->data['shipping_address']['country'] = '';
							$this->session->data['shipping_address']['iso_code_2'] = '';
							$this->session->data['shipping_address']['iso_code_3'] = '';
							$this->session->data['shipping_address']['address_format'] = '';
						}

						if ($zone_info) {
							$this->session->data['shipping_address']['zone'] = $zone_info['name'];
							$this->session->data['shipping_address']['zone_code'] = $zone_info['code'];
						} else {
							$this->session->data['shipping_address']['zone'] = '';
							$this->session->data['shipping_address']['zone_code'] = '';
						}

						if (isset($data['personal_details']['custom_field']['address'])) {
							$this->session->data['shipping_address']['custom_field'] = $data['personal_details']['custom_field']['address'];
						} else {
							$this->session->data['shipping_address']['custom_field'] = array();
						}
					}else{
						$this->load->model('extension/onepagecheckout/customer');
						
						$this->session->data['shipping_address']['firstname'] = (isset($data['delivery_details']['firstname']) ? $data['delivery_details']['firstname'] : '');
						$this->session->data['shipping_address']['lastname'] = (isset($data['delivery_details']['lastname']) ? $data['delivery_details']['lastname'] : '');
						$this->session->data['shipping_address']['company'] = (isset($data['delivery_details']['company']) ? $data['delivery_details']['company'] : '');
						$this->session->data['shipping_address']['address_1'] = (isset($data['delivery_details']['address_1']) ? $data['delivery_details']['address_1'] : '');
						$this->session->data['shipping_address']['address_2'] = (isset($data['delivery_details']['address_2']) ? $data['delivery_details']['address_2'] : '');
						$this->session->data['shipping_address']['postcode'] = (isset($data['delivery_details']['postcode']) ? $data['delivery_details']['postcode'] : '');
						$this->session->data['shipping_address']['city'] = (isset($data['delivery_details']['city']) ? $data['delivery_details']['city'] : '');
						$this->session->data['shipping_address']['country_id'] = (isset($data['delivery_details']['country_id']) ? $data['delivery_details']['country_id'] : '');
						$this->session->data['shipping_address']['zone_id'] = (isset($data['delivery_details']['zone_id']) ? $data['delivery_details']['zone_id'] : '');

						$this->load->model('localisation/country');

						$country_info = $this->model_localisation_country->getCountry((isset($data['delivery_details']['country_id']) ? $data['delivery_details']['country_id'] : ''));

						if ($country_info) {
							$this->session->data['shipping_address']['country'] = $country_info['name'];
							$this->session->data['shipping_address']['iso_code_2'] = $country_info['iso_code_2'];
							$this->session->data['shipping_address']['iso_code_3'] = $country_info['iso_code_3'];
							$this->session->data['shipping_address']['address_format'] = $country_info['address_format'];
						} else {
							$this->session->data['shipping_address']['country'] = '';
							$this->session->data['shipping_address']['iso_code_2'] = '';
							$this->session->data['shipping_address']['iso_code_3'] = '';
							$this->session->data['shipping_address']['address_format'] = '';
						}

						$this->load->model('localisation/zone');

						$zone_info = $this->model_localisation_zone->getZone((isset($data['delivery_details']['zone_id']) ? $data['delivery_details']['zone_id'] : ''));

						if ($zone_info) {
							$this->session->data['shipping_address']['zone'] = $zone_info['name'];
							$this->session->data['shipping_address']['zone_code'] = $zone_info['code'];
						} else {
							$this->session->data['shipping_address']['zone'] = '';
							$this->session->data['shipping_address']['zone_code'] = '';
						}

						if (isset($data['delivery_details']['custom_field'])) {
							$this->session->data['shipping_address']['custom_field'] = $data['delivery_details']['custom_field'];
						} else {
							$this->session->data['shipping_address']['custom_field'] = array();
						}
					}
				}
				$json['success'] = 'Guest';
		 }
		 //Guest
		return $json;
	}
	
	public function updatetelephone(){
		$this->language->load('extension/onepagecheckout/checkout');
		if(!empty($this->request->post['telephone'])){
			$this->db->query("UPDATE ".DB_PREFIX."customer SET telephone = '".$this->db->escape($this->request->post['telephone'])."' WHERE customer_id = '".$this->customer->getId()."'");
			$json['success'] = $this->language->get('text_success_telephone');
		}else{
			$onepagecheckout_manage = $this->config->get('onepagecheckout_manage');
			$json['error']  = (isset($onepagecheckout_manage['register']['error'][$this->config->get('config_language_id')]) ? $onepagecheckout_manage['register']['error'][$this->config->get('config_language_id')] : 'error telephone');
		}
		
		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput(json_encode($json));
	}
	
	public function savedata(){
		$json=array();
		if(isset($this->request->post['personal_details'])){
			foreach($this->request->post['personal_details'] as $key => $value){
				if($key=='customer_group_id'){
					$this->session->data['guest']['customer_group_id'] = $value;
				}
				
				if($key=='firstname'){
					$this->session->data['guest']['firstname'] = $value;
				}
				
				if($key=='lastname'){
					$this->session->data['guest']['lastname'] = $value;
				}
				
				if($key=='email' && filter_var($value, FILTER_VALIDATE_EMAIL)){
					$this->session->data['guest']['email'] = $value;
				}
				
				if($key=='telephone'){
					$this->session->data['guest']['telephone'] = $value;
				}
				
				if($key=='fax'){
					$this->session->data['guest']['fax'] = $value;
				}
			}
			$json[] = $this->session->data['guest']; 
		}
		print_r(json_encode($json));
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit