show_captcha(); } function index($prdtag) { $this->commonfunctions->funsiteRuninIndia(); $lang = PROGRAMLANGUAGE; $this->loadModel("Banner"); $BannerArr = $this->Banner->find('all', array('fields' => array('bannerimage'),'conditions' => array('removed' => 'N'),'order' => 'rand()','limit'=>'1')); $BannerImage=""; $order="Item.gorder Asc,Item.id Asc"; if(count($BannerArr)>0) {$BannerImage=$BannerArr[0]['Banner']['bannerimage'];} $this->set('BannerImage', $BannerImage); if(strtolower($prdtag)=="new_arrivals") { $specialtag="newitem"; $labelname="New Item"; $order="Item.id DESC"; } elseif(strtolower($prdtag)=="hot_item") { $specialtag="hotitem"; $labelname="Hot Item"; } elseif(strtolower($prdtag)=="best_sellers") { $specialtag="bestsell"; $labelname="Best Sellers"; } elseif(strtolower($prdtag)=="express_shipping") { $specialtag="expsell"; $labelname="Express Selling"; } elseif(strtolower($prdtag)=="featured") { $specialtag="featured"; $labelname="Featured Product"; } elseif(strtolower($prdtag)=="special_item") { $specialtag="spitem"; $labelname="Special Product"; } // $sPageTitle = "Monarch Garments($labelname)"; //$this -> set('sPageTitle',$labelname); // $this -> set('labelname',"Home >$labelname"); $this -> set('specialtag',"$specialtag"); $this -> set('labelname',"$labelname"); $condtions = "Itemslng.lngid='$lang'and Item.removed='N' and Item.$specialtag='Y' "; $criteria=NULL; list($order_old,$limit,$page) = $this->Pagination->init($condtions); // Added $arrItem = $this->Item->findAll($condtions, NULL, $order, $limit, $page); // Extra parameters added $this->set('arrItem',$arrItem); $this->loadModel("Testimonal"); $TestimonalArr = $this->Testimonal ->find('all', array('conditions' => array('Testimonal.removed' => 'N','Testimonal.approved'=>'Y'),'order' => 'rand()','limit'=>'1')); if(count($TestimonalArr)>0) { foreach($TestimonalArr as $key => $value) { $testimonalid=$value['Testimonal']['id']; $testimonaltitle=$value['Testimonal']['testimonaltitle']; $testmetter=$value['Testimonal']['testmetter']; $postby=$value['Testimonal']['postby']; } }else { $testimonaltitle=""; $postby=""; $testmetter=""; } $this->set('testimonaltitle', $testimonaltitle); $this->set('postby', $postby); $this->set('testmetter', $testmetter); } function search($tag,$tagvalue) { $this->commonfunctions->funsiteRuninIndia(); $lang = PROGRAMLANGUAGE; $this->loadModel("Banner"); //$BannerArr = $this->Banner->find('all', array('fields' => array('bannerimage'),'conditions' => array('removed' => 'N'),'order' => 'rand()','limit'=>'1')); $BannerArr = $this->Banner->find('all', array('fields' => array('bannerimage'),'conditions' => array('removed' => 'N'),'order' => 'rand()','limit'=>'1'), array('cache' => 'Banersearch', 'cacheConfig' => 'long')); $BannerImage=""; if(count($BannerArr)>0) {$BannerImage=$BannerArr[0]['Banner']['bannerimage'];} $this->set('BannerImage', $BannerImage); $this->set('tag', $tag); $this->set('tagvalue', $tagvalue); $this->loadModel("Testimonal"); //$TestimonalArr = $this->Testimonal ->find('all', array('conditions' => array('Testimonal.removed' => 'N','Testimonal.approved'=>'Y'),'order' => 'rand()','limit'=>'1')); $TestimonalArr = $this->Testimonal ->find('all', array('conditions' => array('Testimonal.removed' => 'N','Testimonal.approved'=>'Y'),'order' => 'rand()','limit'=>'1'), array('cache' => 'Testimonalsearch', 'cacheConfig' => 'long')); if(count($TestimonalArr)>0) { foreach($TestimonalArr as $key => $value) { $testimonalid=$value['Testimonal']['id']; $testimonaltitle=$value['Testimonal']['testimonaltitle']; $testmetter=$value['Testimonal']['testmetter']; $postby=$value['Testimonal']['postby']; } }else { $testimonaltitle=""; $postby=""; $testmetter=""; } $this->set('testimonaltitle', $testimonaltitle); $this->set('postby', $postby); $this->set('testmetter', $testmetter); $sPageTitle = "InMonarch-Search"; $this -> set('sPageTitle','Search'); $this -> set('labelname',"Search"); $strpruductall=""; $CategoryArrayStr=""; $MainCategoryArrayStr=""; if($tag=="color") { $colorid=0; $this->loadModel("Color"); $tagvalue="$tagvalue"; //$ColorArr = $this->Color->find('all', array('fields' => array('id'),'conditions' => array('removed' => 'N','Colorlng.lngid'=>$lang,'Color.code'=>$tagvalue))); $ColorArr = $this->Color ->find('all',array('fields' => array('id'),'conditions' => array('removed' => 'N','Colorlng.lngid'=> $lang,'Color.xname'=> $tagvalue)), array('cache' => 'Colorsearch', 'cacheConfig' => 'long')); if(count($ColorArr)>0) { $colorid=$ColorArr[0]['Color']['id']; } /* $this->loadModel("Productcolor"); $ProductsArr = $this->Productcolor->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('colorid' => $colorid))); */ $this->loadModel("Productsmartshop"); //$ProductsArr = $this->Productsmartshop ->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('colorid' => $colorid))); $ProductsArr = $this->Productsmartshop ->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('colorid' => $colorid)), array('cache' => 'Productsmartshop', 'cacheConfig' => 'long')); if(count($ProductsArr)>0) { foreach($ProductsArr as $key => $values) { $Itemsel=$values['Productsmartshop']['itemid']; if($Itemsel>0) { if($strpruductall!=""){$strpruductall=$strpruductall.",";} $strpruductall=$strpruductall."$Itemsel"; } } } $StrPrdArray = explode(",", $strpruductall); $this -> set('StrPrdArray',$StrPrdArray); } elseif($tag=="fabric") { $febricid=0; //$this->loadModel("Febric"); $this->loadModel("Febriclng"); // $FebricArr = $this->Febric ->find('all', array('fields' => array('id'),'conditions' => array('removed' => 'N','id'=>$tagvalue))); //$FebricArr = $this->Febric ->find('all', array('fields' => array('id'),'conditions' => array('removed' => 'N','slug_name'=>$tagvalue)), array('cache' => 'Febric', 'cacheConfig' => 'long')); $FebricArr = $this->Febriclng->find('all', array('fields' => array('febric_id'),'conditions' => array('slug_name'=>$tagvalue)), array('cache' => 'Febriclng', 'cacheConfig' => 'long')); //echo "
";print_r($FebricArr);
           if(count($FebricArr)>0)
               {$febricid=$FebricArr[0]['Febriclng']['febric_id'];}                                                               
               
            $this->loadModel("Productfebric");
            //$ProductsArr = $this->Productfebric->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('febricid' => $febricid)));
            //$ProductsArr = $this->Productfebric ->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('febricid' => $febricid)), array('cache' => 'Productfebric', 'cacheConfig' => 'long'));
            //$ProductsArr = $this->Item ->find('all', array('fields' => array('DISTINCT id'),'conditions' => array('fabricid' => $febricid,'removed' => 'N','dissapprove'=>'Y')), array('cache' => 'Productfebric', 'cacheConfig' => 'long'));
            
	 $ProductsArr = $this->Item->find("all",array("joins"     =>array("INNER JOIN febrics  as Febric ON Item.fabricid = Febric.id INNER JOIN febriclngs as Febriclng on Febriclng.febric_id = Febric.id"),
                                                            'order' => array('maincategory_id'),
                                                            "fields"     => array('Item.id'),
                                                            "conditions" => array('Febriclng.slug_name'=>$tagvalue,'Item.dissapprove'=>'Y','Item.removed'=>'N' ), array('cache' => 'MatchAccessories', 'cacheConfig' => 'long')
                                                            )
                                                );
           // echo "
";print_r($ProductsArr);
            if(count($ProductsArr)>0)
            {
               foreach($ProductsArr as $key => $values)
                 {
                     $Itemsel=$values['Item']['id'];
                     
                     if($Itemsel>0)
                     {
                         if($strpruductall!="")
                        { 
                          $strpruductall=$strpruductall.",";
                        }
                        $strpruductall=$strpruductall."$Itemsel";
                     }
                 }
            }
            $StrPrdArray = explode(",", $strpruductall);
            $this -> set('StrPrdArray',$StrPrdArray);
          
         }
      elseif($tag=="material")
         {
            $materialid=0;
            $this->loadModel("Material");
            //$MaterialArr = $this->Material->find('all', array('fields' => array('id'),'conditions' => array('removed' => 'N','code'=>$tagvalue)));
            $MaterialArr = $this->Material->find('all', array('fields' => array('id'),'conditions' => array('removed' => 'N','code'=>$tagvalue)), array('cache' => 'Material', 'cacheConfig' => 'long'));
            if(count($MaterialArr)>0)
               {$materialid=$MaterialArr[0]['Material']['id'];}                                                               
               
            $this->loadModel("Productmeterial");
            //$ProductsArr = $this->Productmeterial->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('meterialid' => $materialid)));
            $ProductsArr = $this->Productmeterial->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('meterialid' => $materialid)), array('cache' => 'Productmeterial', 'cacheConfig' => 'long'));
          // pr($ProductsArr); 
            if(count($ProductsArr)>0)
            {
               foreach($ProductsArr as $key => $values)
                 {
                    # if(!empty($values['Productfebric']))
                    # {
                        # if(!empty($values['Itemsel']))
                        # {
                        $Itemsel=$values['Productmeterial']['itemid'];
                        # }
                        if($Itemsel>0)
                        {
                           if($strpruductall!=""){$strpruductall=$strpruductall.",";}
                           $strpruductall=$strpruductall."$Itemsel";
                        }
                     # }
                 }
                 
                 
            }
            
            
            $StrPrdArray = explode(",", $strpruductall);
            $this -> set('StrPrdArray',$StrPrdArray);
         }
      elseif($tag=="occasion")
         {
            $occasionid=0;
            $this->loadModel("Alloccasion");
            //$OccasionArr = $this->Occasion->find('all', array('fields' => array('id'),'conditions' => array('removed' => 'N','code'=>$tagvalue)));
            $OccasionArr = $this->Alloccasion->find('all', array('fields' => array('id'),'conditions' => array('removed' => 'N','slug_name'=>$tagvalue)), array('cache' => 'Occasion', 'cacheConfig' => 'long'));
                                                                      
                //     pr($OccasionArr);                                                        
            if(count($OccasionArr)>0)
               {$occasionid=$OccasionArr[0]['Alloccasion']['id'];}                                                               
               
            $this->loadModel("Productoccp");
            //$ProductsArr = $this->Productoccp->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('occpid' => $occasionid)));
            $ProductsArr = $this->Productoccp->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('occpid' => $occasionid)), array('cache' => 'Productoccp', 'cacheConfig' => 'long'));
            if(count($ProductsArr)>0)
            {
               foreach($ProductsArr as $key => $values)
                 {
                     # if(!empty($values['Productfebric']))
                     # { 
                        # if(!empty($values['Itemsel']))
                        # {
                          $Itemsel=$values['Productoccp']['itemid'];
                        # }
                        if($Itemsel>0)
                        {
                           if($strpruductall!=""){$strpruductall=$strpruductall.",";}
                           $strpruductall=$strpruductall."$Itemsel";
                        }
                     # }
                 }
            }
            
            $StrPrdArray = explode(",", $strpruductall);
            $this -> set('StrPrdArray',$StrPrdArray);
         }
      elseif($tag=="price")
      {
         list($minprice, $maxprice) = split('-', $tagvalue);
         $inindia=RUNININDIA;
         
         /*$minprice=($minprice/$baserate);
         $maxprice=($maxprice/$baserate);*/
         
          $query3         = "select in_usd from currencies where name='".$this->Session->read('Config.currency')."'";
          $result3        = @mysql_query($query3);
          $row3           = @mysql_fetch_assoc($result3);
          
          $maxprice     = $maxprice/$row3['in_usd'];
          $minprice     = $minprice/$row3['in_usd'];
          
          //echo $maxprice."---".$minprice;exit;
          
         if($inindia==true)
            {$prdfld="lastprice";}
         else
            {$prdfld="baselastprice";}
         //$ProductsArr = $this->Item->find('all',array('fields' => array('DISTINCT id'),'conditions' => array('removed'=>'N',"$prdfld BETWEEN ? AND ?" => array($minprice, $maxprice))));
         $ProductsArr = $this->Item->find('all',array('fields' => array('DISTINCT id'),'order' => array('maincategory_id'),'conditions' => array('removed'=>'N',"$prdfld BETWEEN ? AND ?" => array($minprice, $maxprice))), array('cache' => 'Itemprice', 'cacheConfig' => 'long'));                                 
         
          if(count($ProductsArr)>0)
            {
               foreach($ProductsArr as $key => $values)
                 {
                     $Itemsel=$values['Item']['id'];
                     if($Itemsel>0)
                     {
                        if($strpruductall!=""){$strpruductall=$strpruductall.",";}
                        $strpruductall=$strpruductall."$Itemsel";
                     }
                 }
            }
         $StrPrdArray = explode(",", $strpruductall);
         $this -> set('StrPrdArray',$StrPrdArray);
      }
      
      if($strpruductall!="")
         {
            //$ProductsArr = $this->Item->find("all",array('fields' => array('DISTINCT category_id'),'conditions' => array('removed'=>'N','id ' => $StrPrdArray)));
            $ProductsArrq = $this->Item->find('all',array('fields' => array('DISTINCT category_id','subcategory_id'),'order' => array('maincategory_id'),'conditions' => array('removed'=>'N','id ' => $StrPrdArray)), array('cache' => 'Itemproduct', 'cacheConfig' => 'long'));                                 
            
            
            
               if(count($ProductsArrq)>0)
                  {
                     foreach($ProductsArrq as $key => $values)
                       {
                            $Itemsel=$values['Item']['category_id'];
                             $subcategory_id=$values['Item']['subcategory_id'];
                           if($subcategory_id!=0)
                           {
                            if($SubCategoryArrayStr!="")
                                       {
                                         $SubCategoryArrayStr=$SubCategoryArrayStr.",";
                                       }
                                       $SubCategoryArrayStr=$SubCategoryArrayStr."$subcategory_id";
                              
                           }
                          elseif($Itemsel > 0)
                           {
                          
                              if($CategoryArrayStr!="")
                              {
                                $CategoryArrayStr=$CategoryArrayStr.",";
                              }
                              $CategoryArrayStr=$CategoryArrayStr."$Itemsel";
                           }
                           else
                           {
                           //$ProductsArr1 = $this->Item->find("all",array('fields' => array('DISTINCT maincategory_id'),'conditions' => array('removed'=>'N','id ' => $StrPrdArray)));
                           $ProductsArr1 = $this->Item->find('all',array('fields' => array('DISTINCT maincategory_id'),'order' => array('maincategory_id'),'conditions' => array('removed'=>'N','id ' => $StrPrdArray)), array('cache' => 'Itemmaincatproduct', 'cacheConfig' => 'long'));                                 
                            
                             // $this->Item->recursive = -1;
                              # $ProductsArr1 = $this->Item->find("all", 
                                                 # array('fields' => array('DISTINCT Item.maincategory_id'),
                                                 # array('joins'  =>array('table' => 'maincat',
                                                                        # 'alias'=>'Maincategory',
                                                                        # 'type' => 'inner',                                                                           
                                                                        # 'conditions'=> array('Maincategory.id=Item.maincategory_id','Maincategory.childcatexist = N')
                                                                        # )),
                                                     # 'conditions' => array('removed'=>'N',
                                                                               # 'id ' => $StrPrdArray
                                                                               
                                                                               # )
                                                   # )
                                                   # );
                                                # pr($ProductsArr1)   ;
                              foreach($ProductsArr1 as $key1 => $values1)
                              {
                                 
                                 $MainCat_Id=$values1['Item']['maincategory_id'];
                                 if($MainCat_Id > 0)
                                 {
                                    if($MainCategoryArrayStr!="")
                                    {
                                      $MainCategoryArrayStr=$MainCategoryArrayStr.",";
                                    }
                                    $MainCategoryArrayStr=$MainCategoryArrayStr."$MainCat_Id";
                                 }
                              }
                           }
                       }
                  }
         }
       //pr($CategoryArrayStr);
         $this -> set('CategoryArrayStr',$CategoryArrayStr);   
       
      if($CategoryArrayStr=="")
         {$CategoryArrayStr="0";}
      
      
      $this->loadModel("Category");
      $this->loadModel("Maincategory");
      $this->loadModel("Subcategory");
      
      if(!empty($StrPrdArray))
         $this -> set('StrPrdArray',$StrPrdArray);
        // echo $CategoryArrayStr;
        // echo $CategoryArrayStr;
        // echo $MainCategoryArrayStr;
     //if(($CategoryArrayStr!=0 )|| ($CategoryArrayStr==""))
     
     /*echo $MainCategoryArrayStr;
     echo "
"; echo $CategoryArrayStr; echo "
"; echo $SubCategoryArrayStr;*/ if($SubCategoryArrayStr!=0) { $MainCat_Exists = 0; $mem_ids= explode(",", $SubCategoryArrayStr); //pr($mem_ids); //$MainCat_Exists = 0; // $CategoryArray = $this->Category->find('all', array('fields' => array('DISTINCT id','childcatcode','childcatname'),'conditions' => array('removed' => 'N','id ' => $mem_ids,'lngid'=>$lang),'order'=>'id')); $SubCategoryArray = $this->Subcategory->find('all',array('fields' => array('DISTINCT id','subcatcode','subcatname','slug_subcatname'),'order'=>array('maincatid'),'conditions' => array('removed'=>'N','id ' => $mem_ids,'lngid'=>$lang)), array('cache' => 'Itemcatproduct', 'cacheConfig' => 'long')); $this -> set('SubCategoryArray',$SubCategoryArray); $this -> set('MainCatExists',$MainCat_Exists); } if($CategoryArrayStr!=0 ) { $mem_ids= explode(",", $CategoryArrayStr); //pr($mem_ids); $MainCat_Exists = 0; // $CategoryArray = $this->Category->find('all', array('fields' => array('DISTINCT id','childcatcode','childcatname'),'conditions' => array('removed' => 'N','id ' => $mem_ids,'lngid'=>$lang),'order'=>'id')); $CategoryArray = $this->Category->find('all',array('fields' => array('DISTINCT id','childcatcode','childcatname','slug_childcatname'),'order'=>array('maincatid'),'conditions' => array('removed'=>'N','id ' => $mem_ids,'lngid'=>$lang)), array('cache' => 'Itemcatproduct', 'cacheConfig' => 'long')); $this -> set('CategoryArray',$CategoryArray); $this -> set('MainCatExists',$MainCat_Exists); } //if(($MainCategoryArrayStr!=0)||($MainCategoryArrayStr=="")) if(($MainCategoryArrayStr!=0)) { $MainCat_Exists = 1; $MainCat_Ids= explode(",", $MainCategoryArrayStr); //$Main_CategoryArray = $this->Maincategory->find('all', array('fields' => array('DISTINCT id','maincatcode'),'conditions' => array('id ' => $MainCat_Ids),'order'=>'id')); $Main_CategoryArray = $this->Maincategory->find('all', array('fields' => array('DISTINCT id','maincatcode','slug_maincatname'),'conditions' => array('id ' => $MainCat_Ids),'order'=>'id'), array('cache' => 'Itemcatproduct', 'cacheConfig' => 'long')); $this -> set('Main_CategoryArray',$Main_CategoryArray); $this -> set('MainCatExists',$MainCat_Exists); } } function searchall($type,$categoryid,$tag,$tagvalue,$categoryname) { $this->commonfunctions->funsiteRuninIndia(); $lang = PROGRAMLANGUAGE; $sPageTitle = "InMonarch-Search"; $this -> set('sPageTitle','Search'); $this -> set('labelname',"Search"); $this->set('tag', $tag); $this->set('tagvalue', $tagvalue); $this->set('categoryid', $categoryid); $this->set('categoryname', $categoryname); $BannerImage=""; $this->loadModel("Banner"); $BannerArr = $this->Banner->find('all', array('fields' => array('bannerimage'),'conditions' => array('removed' => 'N','category_id'=>$categoryid),'order' => 'rand()','limit'=>'1')); if(count($BannerArr)>0) {$BannerImage=$BannerArr[0]['Banner']['bannerimage'];} else { $BannerArr = $this->Banner->find('all', array('fields' => array('bannerimage'),'conditions' => array('removed' => 'N'),'order' => 'rand()','limit'=>'1')); if(count($BannerArr)>0) {$BannerImage=$BannerArr[0]['Banner']['bannerimage'];} } $this->set('BannerImage', $BannerImage); $strpruductall=""; $CategoryArrayStr=""; if($tag=="color") { $colorid=0; $this->loadModel("Color"); //$tagvalue="#$tagvalue"; $ColorArr = $this->Color->find('all', array( 'fields' => array('id'), 'conditions' => array('removed' => 'N', 'Colorlng.lngid'=>$lang, 'Color.xname'=>$tagvalue))); if(count($ColorArr)>0) {$colorid=$ColorArr[0]['Color']['id'];} // $this->loadModel("Productcolor"); //$ProductsArr = $this->Productcolor->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('colorid' => $colorid))); $this->loadModel("Productsmartshop"); if($type=="subcategory") { $ProductsArr = $this->Productsmartshop->find("all",array("joins" =>array("INNER JOIN items as Item ON Item.id = Productsmartshop.itemid"), "fields" => array('Item.id'), "conditions" => array('Productsmartshop.colorid'=>$colorid,'Item.dissapprove'=>'Y','Item.subcategory_id'=>$categoryid ), array('cache' => 'MatchAccessories', 'cacheConfig' => 'long') ) ); } elseif($type=="category") { $ProductsArr = $this->Productsmartshop->find("all",array("joins" =>array("INNER JOIN items as Item ON Item.id = Productsmartshop.itemid"), "fields" => array('Item.id'), "conditions" => array('Productsmartshop.colorid'=>$colorid,'Item.dissapprove'=>'Y','Item.category_id'=>$categoryid ), array('cache' => 'MatchAccessories', 'cacheConfig' => 'long') ) ); //echo "
";print_r($ProductsArr);
            }
           else
            {
              $ProductsArr = $this->Productsmartshop->find("all",array("joins"     =>array("INNER JOIN items as Item ON Item.id = Productsmartshop.itemid"),
                                                            "fields"     => array('Item.id'),
                                                            "conditions" => array('Productsmartshop.colorid'=>$colorid,'Item.dissapprove'=>'Y','Item.maincategory_id'=>$categoryid ), array('cache' => 'MatchAccessories', 'cacheConfig' => 'long')
                                                            )
                                                );
            }  
            
          if(count($ProductsArr)>0)
            {
               foreach($ProductsArr as $key => $values)
                 {
                     //$Itemsel=$values['Productcolor']['itemid'];
                      $Itemsel=$values['Item']['id'];
                     if($Itemsel>0)
                     {
                        if($strpruductall!=""){$strpruductall=$strpruductall.",";}
                        $strpruductall=$strpruductall."$Itemsel";
                     }
                 }
            }
         
         # $StrPrdArray = explode(",", $strpruductall);
         # $this -> set('StrPrdArray',$StrPrdArray);
         
      }
      elseif($tag=="fabric")
         {
        
            $febricid=0;
            $this->loadModel("Febriclng");
            $FebricArr = $this->Febriclng->find('all', array('fields' => array('febric_id'),'conditions' => array('slug_name'=>$tagvalue)));
         
           
            
            if(count($FebricArr)>0)
            {
               $febricid=$FebricArr[0]['Febriclng']['febric_id'];
            }                                                               
          //  $Itemarray=$this->Item->find('all',arry('fields'=>array('maincategory_id','category_id','subcategory_id'),'conditions'=>array('removed'=>'N')))   
            $this->loadModel("Productfebric");
           if($type=='maincategory')
            {
             /*
             $ProductsArr = $this->Productfebric->find('all', array(
                                                                     'fields' => array('DISTINCT Productfebric.itemid'),
                                                                     'joins'=>array(
                                                                                    array(
                                                                                          'table' => 'items',
                                                                                          'alias' => 'Item',
                                                                                          'type'  => 'inner',
                                                                                          'foreignKey' => false,
                                                                                          'conditions'=> array('Item.id=Productfebric.itemid')
                                                                                          ),
                                                                                        array(
                                                                                          'table' => 'febriclngs',
                                                                                          'alias' => 'febriclngs',
                                                                                          'type'  => 'inner',
                                                                                          'foreignKey' => false,
                                                                                          'conditions'=> array('Productfebric.febricid=febriclngs.febric_id')
                                                                                          )  
                                                                                    ),
                                                                                                    
                                                                     'conditions' => array('Item.maincategory_id'=> $categoryid,'febriclngs.slug_name' => $tagvalue,'Item.dissapprove' =>'Y')
                                                                  )
                                                      );
             */
              $ProductsArr = $this->Item->find("all",array("joins"     =>array("INNER JOIN febriclngs as Febriclng on Febriclng.febric_id = Item.fabricid"),
                                                            "fields"     => array('Item.id'),
                                                            "conditions" => array('Febriclng.slug_name'=>$tagvalue,'Item.dissapprove'=>'Y','Item.removed'=>'N' ,'Item.maincategory_id'=> $categoryid), array('cache' => 'MatchAccessories', 'cacheConfig' => 'long')
                                                            )
                                                );  
                                                    
            }
            elseif($type=='category')
            {
             /*
             $ProductsArr = $this->Productfebric->find('all', array(
                                                                     'fields' => array('DISTINCT Productfebric.itemid'),
                                                                     'joins'=>array(
                                                                                    array(
                                                                                          'table' => 'items',
                                                                                          'alias' => 'Item',
                                                                                          'type'  => 'inner',
                                                                                          'foreignKey' => false,
                                                                                          'conditions'=> array('Item.id=Productfebric.itemid')
                                                                                          ),
                                                                                            array(
                                                                                          'table' => 'febriclngs',
                                                                                          'alias' => 'febriclngs',
                                                                                          'type'  => 'inner',
                                                                                          'foreignKey' => false,
                                                                                          'conditions'=> array('Productfebric.febricid=febriclngs.febric_id')
                                                                                          )  
                                                                                    ),
                                                                                                    
                                                                     'conditions' => array('Item.category_id'=> $categoryid,'febriclngs.slug_name' => $tagvalue,'Item.dissapprove' =>'Y')
                                                                  )
                                                      );
             */
              $ProductsArr = $this->Item->find("all",array("joins"     =>array("INNER JOIN febriclngs as Febriclng on Febriclng.febric_id = Item.fabricid"),
                                                            "fields"     => array('Item.id'),
                                                            "conditions" => array('Febriclng.slug_name'=>$tagvalue,'Item.dissapprove'=>'Y','Item.removed'=>'N' ,'Item.category_id'=> $categoryid), array('cache' => 'MatchAccessories', 'cacheConfig' => 'long')
                                                            )
                                                );
            }
           else
            {
             /*
              $ProductsArr = $this->Productfebric->find('all', array(
                                                                     'fields' => array('DISTINCT Productfebric.itemid'),
                                                                     'joins'=>array(
                                                                                    array(
                                                                                          'table' => 'items',
                                                                                          'alias' => 'Item',
                                                                                          'type'  => 'inner',
                                                                                          'foreignKey' => false,
                                                                                          'conditions'=> array('Item.id=Productfebric.itemid')
                                                                                          ),
                                                                                            array(
                                                                                          'table' => 'febriclngs',
                                                                                          'alias' => 'febriclngs',
                                                                                          'type'  => 'inner',
                                                                                          'foreignKey' => false,
                                                                                          'conditions'=> array('Productfebric.febricid=febriclngs.febric_id')
                                                                                          )  
                                                                                    ),
                                                                                                    
                                                                     'conditions' => array('Item.subcategory_id'=> $categoryid,'febriclngs.slug_name' => $tagvalue,'Item.dissapprove' =>'Y')
                                                                  )
                                                      );
             */
               $ProductsArr = $this->Item->find("all",array("joins"     =>array(" INNER JOIN febriclngs as Febriclng on Febriclng.febric_id = Item.fabricid"),
                                                            "fields"     => array('Item.id'),
                                                            "conditions" => array('Febriclng.slug_name'=>$tagvalue,'Item.dissapprove'=>'Y','Item.removed'=>'N' ,'Item.subcategory_id'=> $categoryid), array('cache' => 'MatchAccessories', 'cacheConfig' => 'long')
                                                            )
                                                );
            }           
        
            if(count($ProductsArr)>0)
            {
                foreach($ProductsArr as $key => $values)
               {
                  $Itemsel=$values['Item']['id'];
                   if($Itemsel>0)
                  {
                        if($strpruductall!=""){$strpruductall=$strpruductall.",";}
                        $strpruductall=$strpruductall."$Itemsel";
                  }
               }
            }
              $StrPrdArray = explode(",", $strpruductall);
              $this -> set('StrPrdArray',$StrPrdArray);
         }
      elseif($tag=="material")
         {
            $materialid=0;
            $this->loadModel("Material");
            $MaterialArr = $this->Material->find('all', array(
                                                      'fields' => array('id'),
                                                      'conditions' => array('removed' => 'N',
                                                                           'code'=>$tagvalue)));
            if(count($MaterialArr)>0)
               {$materialid=$MaterialArr[0]['Material']['id'];}                                                               
               
            $this->loadModel("Productmeterial");
            //$ProductsArr = $this->Productmeterial->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('meterialid' => $materialid)));
            
            if($type=="subcategory")
            {
             $ProductsArr = $this->Productmeterial->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('meterialid' => $materialid,'Item.dissapprove'=>'Y','Item.subcategory_id'=>$categoryid )));                                 
            }
           elseif($type=="category")
            {
             $ProductsArr = $this->Productmeterial->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('meterialid' => $materialid,'Item.dissapprove'=>'Y','Item.category_id'=>$categoryid )));                                                                    
            }
           else
            {
             $ProductsArr = $this->Productmeterial->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('meterialid' => $materialid,'Item.dissapprove'=>'Y','Item.maincategory_id'=>$categoryid )));                                                                                                      
            }  
            
            if(count($ProductsArr)>0)
            {
               foreach($ProductsArr as $key => $values)
                 {
                     $Itemsel=$values['Productfebric']['itemid'];
                     if($Itemsel>0)
                     {
                        if($strpruductall!=""){$strpruductall=$strpruductall.",";}
                        $strpruductall=$strpruductall."$Itemsel";
                     }
                 }
            }
            $StrPrdArray = explode(",", $strpruductall);
            $this -> set('StrPrdArray',$StrPrdArray);
         }
      elseif($tag=="occasion")
         {
            $occasionid=0;
            $this->loadModel("Occasion");
            $OccasionArr = $this->Occasion->find('all', array(
                                                      'fields' => array('id'),
                                                      'conditions' => array('removed' => 'N',
                                                                           'code'=>$tagvalue)));
                                                                   
            if(count($OccasionArr)>0)
               {$occasionid=$OccasionArr[0]['Occasion']['id'];}                                                               
               
            $this->loadModel("Productoccp");
           // $ProductsArr = $this->Productoccp->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('occpid' => $occasionid)));
          if($type=="subcategory")
            {
             $ProductsArr = $this->Productoccp->find("all",array("joins"     =>array("INNER JOIN items as Item ON Item.id = Productoccp.itemid"),
                                                            "fields"     => array('Item.id'),
                                                            "conditions" => array('Productoccp.occpid'=>$occasionid,'Item.dissapprove'=>'Y','Item.subcategory_id'=>$categoryid ), array('cache' => 'MatchAccessories', 'cacheConfig' => 'long')
                                                            )
                                                );
             
             
            }
           elseif($type=="category")
            {
            // $ProductsArr = $this->Productoccp->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('occpid' => $occasionid,'Item.dissapprove'=>'Y','Item.category_id'=>$categoryid )));
             $ProductsArr = $this->Productoccp->find("all",array("joins"     =>array("INNER JOIN items as Item ON Item.id = Productoccp.itemid"),
                                                            "fields"     => array('Item.id'),
                                                            "conditions" => array('Productoccp.occpid'=>$occasionid,'Item.dissapprove'=>'Y','Item.category_id'=>$categoryid ), array('cache' => 'MatchAccessories', 'cacheConfig' => 'long')
                                                            )
                                                );
             
             
            }
           else
            {
              //$ProductsArr = $this->Productoccp->find('all', array('fields' => array('DISTINCT itemid'),'conditions' => array('occpid' => $occasionid,'Item.dissapprove'=>'Y','Item.maincategory_id'=>$categoryid )));
                $ProductsArr = $this->Productoccp->find("all",array("joins"     =>array("INNER JOIN items as Item ON Item.id = Productoccp.itemid"),
                                                            "fields"     => array('Item.id'),
                                                            "conditions" => array('Productoccp.occpid'=>$occasionid,'Item.dissapprove'=>'Y','Item.maincategory_id'=>$categoryid ), array('cache' => 'MatchAccessories', 'cacheConfig' => 'long')
                                                            )
                                                );
            }  
            if(count($ProductsArr)>0)
            {
               foreach($ProductsArr as $key => $values)
                 {
                     $Itemsel=$values['Item']['id'];
                     if($Itemsel>0)
                     {
                        if($strpruductall!=""){$strpruductall=$strpruductall.",";}
                        $strpruductall=$strpruductall."$Itemsel";
                     }
                 }
            }
            # $StrPrdArray = explode(",", $strpruductall);
            # $this -> set('StrPrdArray',$StrPrdArray);
         }
      elseif($tag=="price")
      {
         list($minprice, $maxprice) = split('-', $tagvalue);
         $inindia=RUNININDIA;
         
          $query3         = "select in_usd from currencies where name='".$this->Session->read('Config.currency')."'";
          $result3        = @mysql_query($query3);
          $row3           = @mysql_fetch_assoc($result3);
          
          $maxprice     = $maxprice/$row3['in_usd'];
          $minprice     = $minprice/$row3['in_usd'];
          
         if($inindia==true)
            {$prdfld="lastprice";}
         else
            {$prdfld="baselastprice";}
         //$ProductsArr = $this->Item->find('all', array('fields' => array('DISTINCT id'),'conditions' => array('removed'=>'N',"$prdfld BETWEEN ? AND ?" => array($minprice, $maxprice))));
          
          if($type=="subcategory")
            {
             $ProductsArr = $this->Item->find('all', 
                                          array('fields' => array('DISTINCT id'),
                                          'conditions' => array('Item.dissapprove'=>'Y','Item.subcategory_id'=>$categoryid ,'removed'=>'N',"$prdfld BETWEEN ? AND ?" => array($minprice, $maxprice))
                                                )
                                          );
            }
           elseif($type=="category")
            {
             $ProductsArr = $this->Item->find('all', 
                                          array('fields' => array('DISTINCT id'),
                                          'conditions' => array('Item.dissapprove'=>'Y','Item.category_id'=>$categoryid ,'removed'=>'N',"$prdfld BETWEEN ? AND ?" => array($minprice, $maxprice))
                                                )
                                          );
            }
           else
            {
              $ProductsArr = $this->Item->find('all', 
                                          array('fields' => array('DISTINCT id'),
                                          'conditions' => array('Item.dissapprove'=>'Y','Item.maincategory_id'=>$categoryid ,'removed'=>'N',"$prdfld BETWEEN ? AND ?" => array($minprice, $maxprice))
                                                )
                                          );
            } 
          if(count($ProductsArr)>0)
            {
               foreach($ProductsArr as $key => $values)
                 {
                     $Itemsel=$values['Item']['id'];
                     if($Itemsel>0)
                     {
                        if($strpruductall!=""){$strpruductall=$strpruductall.",";}
                        $strpruductall=$strpruductall."$Itemsel";
                     }
                 }
            }
         # $StrPrdArray = explode(",", $strpruductall);
         # $this -> set('StrPrdArray',$StrPrdArray);
      }
      
        if($strpruductall=="")
       {
         $strpruductall="0";
       }
      
      $condtions = "Itemslng.lngid='$lang' and Item.removed='N' and  Item.id in($strpruductall)";
      $criteria=NULL;
      list($order,$limit,$page) = $this->Pagination->init($condtions); // Added
      $order="Item.gorder Asc,Item.id Asc";
      $arrItem = $this->Item->findAll($condtions, NULL, $order, $limit, $page); // Extra parameters added
     
      $this->set('arrItem',$arrItem); 
         
      $this->loadModel("Testimonal");
      $TestimonalArr = $this->Testimonal ->find('all', array('conditions' => array('Testimonal.removed' => 'N','Testimonal.approved'=>'Y'),'order' => 'rand()','limit'=>'1'));
      if(count($TestimonalArr)>0)
         {
           foreach($TestimonalArr as $key => $value)
             {
               $testimonalid=$value['Testimonal']['id'];
               $testimonaltitle=$value['Testimonal']['testimonaltitle'];
               $testmetter=$value['Testimonal']['testmetter'];
               $postby=$value['Testimonal']['postby'];
             }
         }else
         {
            $testimonaltitle="";
            $postby="";
            $testmetter="";
         }
         $this->set('testimonaltitle', $testimonaltitle);
         $this->set('postby', $postby);
         $this->set('testmetter', $testmetter);
      
   }
 function getoptions()
      {
         $this->layout="";
         $itemid = $_GET['itemid'];
         $newval=$_GET['valobj'];
         $this->loadModel("Shippingitem");
         if($newval=='I')
            {$shippingdaysArr = $this->Shippingitem->find("all",array("conditions" =>array('ItemId'=>$itemid,'expshipping'=>'N')));}
           else 
           {$shippingdaysArr = $this->Shippingitem->find("all",array("conditions" =>array('ItemId'=>$itemid)));}
           $this->set('shippingdaysArr', $shippingdaysArr);
      }     
   function fullpage($id,$pgname=null)
   {
      $this->commonfunctions->funsiteRuninIndia();
      $lngid = PROGRAMLANGUAGE;
      $ItemArr1 = $this->Item->find('all',array('conditions' => array('removed' => 'N','dissapprove'=>'Y','Item.id'=>$id,'lngid'=>$lngid)), array('cache' => 'Item1', 'cacheConfig' => 'long'));
      $labelname=$ItemArr1['0']['Item']['itemname'];
      $companyname=$_SESSION['CompanyDetail']['companyname'];     
      $sPageTitle = "$companyname-$pgname";
      $this -> set('sPageTitle',$sPageTitle);
      $this -> set('labelname',ucwords($labelname));
      $this -> set('fopage',1);
      //echo "
";print_r($ItemArr1);
    
      $sizeimage = '';
      if(!empty($ItemArr1[0]['Item']['subcategory_id'])){
         /*$query = "select sizeimage from subcategory where id='".$ItemArr1[0]['Item']['subcategory_id']."'";
         $result = @mysql_query($query);
         $row = @mysql_fetch_assoc($result);
         $sizeimage= $row['sizeimage'];*/
         $sizeimage="s_".$ItemArr1[0]['Item']['subcategory_id'];
         /*if(!empty($row['sizeimage'])){
            $sizeimage="subcategoryimage_".$ItemArr1[0]['Item']['subcategory_id'];
         }*/
      }else if(!empty($ItemArr1[0]['Item']['category_id'])){
         /*$query = "select sizeimage from childcategory where id='".$ItemArr1[0]['Item']['category_id']."'";
         $result = @mysql_query($query);
         $row = @mysql_fetch_assoc($result);
         $sizeimage= $row['sizeimage'];*/
         $sizeimage="c_".$ItemArr1[0]['Item']['category_id'];
         /*if(!empty($row['sizeimage'])){
            $sizeimage="categoryimage_".$ItemArr1[0]['Item']['category_id'];
         }*/
      }
      
      //echo $sizeimage;exit;
      $this -> set('sizeimage',$sizeimage);
      
      $this->Item->FunInsertDefSetting($id);
      //$arrSystemfld = $this->Itemsetting->find('all', array('conditions' => array('id' => $id)));
      $arrSystemfld = $this->Itemsetting->find('all',array('conditions' => array('id' => $id)), array('cache' => 'Itemsetting', 'cacheConfig' => 'long'));
      $arrSystemfld = $arrSystemfld[0];
      $arrSystemfld = $arrSystemfld['Itemsetting'];
      $this -> set('arrSystemfld',$arrSystemfld);
      $this->set(compact('arrSystemfld'));
      
     // pr($_SESSION);       
     
    $this -> set('shiptypesession',$_SESSION['Order']['shiptype']);
      $this->Item->posterFirstName($id);
      //$ItemArr = $this->Item->find('all',array('conditions' => array('removed' => 'N','Item.id'=>$id,'lngid'=>$lngid)));
      $ItemArr = $this->Item->find('all',array('conditions' => array('removed' => 'N','dissapprove'=>'Y','Item.id'=>$id,'lngid'=>$lngid)), array('cache' => 'Item', 'cacheConfig' => 'long'));
     
     
      $this->set('ItemArr', $ItemArr);
   
      if(count($ItemArr)>0)
         {
            $maincategoryid=$ItemArr['0']['Item']['maincategory_id'];
           $categoryid=$ItemArr['0']['Item']['category_id'];
           $subcategoryid=$ItemArr['0']['Item']['subcategory_id'];
           $fabricidnew=$ItemArr['0']['Item']['fabricid'];
           $blousefeatures=$ItemArr['0']['Item']['blousefeatures'];
           $lehengafeatures=$ItemArr['0']['Item']['lehengafeatures'];
           $lehengafeatures=$ItemArr['0']['Item']['lehengafeatures'];
           
           $cat_items = $this->Item->find(
           	'all',
           	array(
           		'conditions' => array(
           			'Item.category_id' => $categoryid,
           			'Item.removed'	   => 'N',
           			'Item.dissapprove' => 'Y',
           		),
           		'fields' => array(
           			'Item.id','Item.itemcode','Item.itemname','Item.smalling','Item.lastprice','Itemslng.slug_itemname'
           		)
           	)
           );
         }
         //echo "
";print_r( $cat_items);
           $this->set('cat_items', $cat_items);
           $this->set('fabricidnew', $fabricidnew);
           $this->set('blousefeatures', $blousefeatures);
           
      $this->set('lehengafeatures', $lehengafeatures);
      $ItemArrright = $this->Item->find('all', 
                                   array('fields'=>array('DISTINCT id','itemname','fabricid','Itemslng.slug_itemname'),
                                        'conditions' => array(
                                                              'removed' => 'N',
                                                              'dissapprove'=>'Y',
                                                              'Item.id >'=>$id,
                                                              'lngid'=>$lngid,
                                                              'maincategory_id'=>$maincategoryid,
                                                              'category_id'=>$categoryid,
                                                              'subcategory_id'=>$subcategoryid
                                                              ),
                                        # 'order' => array('Item.itemcode')
                                        'order' => array('Item.id asc','Item.itemcode desc'),
                                        'limit' => 1,
                                        ), array('cache' => 'Itemright', 'cacheConfig' => 'long'));
      $rightprdid=Array();
      //pr($ItemArrright);
      if(count($ItemArrright)>0)
         {
            $rightprdid[0]=$ItemArrright['0']['Item']['id'];
            //$rightprdid[1]=$ItemArrright['0']['Items']['itemname'];
            $rightprdid[1]=$ItemArrright['0']['Itemslng']['slug_itemname'];
            
         }
      
     
      $this->set('rightprdid', $rightprdid);
    
      
      $ItemArrright1 = $this->Item->find('all', 
                                   array('fields'=>array('DISTINCT id','itemname','Itemslng.slug_itemname'),
                                        'conditions' => array(
                                                              'removed' => 'N',
                                                              'dissapprove'=>'Y',
                                                              'Item.id <'=>$id,
                                                              'lngid'=>$lngid,
                                                              'maincategory_id'=>$maincategoryid,
                                                              'category_id'=>$categoryid,
                                                              'subcategory_id'=>$subcategoryid
                                                              ),
                                        # 'order' => array('Item.itemcode desc')
                                        'order' => array('Item.id desc','Item.itemcode'),
                                        'limit' => 1,
                                        ), array('cache' => 'Itemleft', 'cacheConfig' => 'long'));
      $LeftPrdId=Array();
     // pr($ItemArrright);
      if(count($ItemArrright1)>0)
         {
            $LeftPrdId[0]=$ItemArrright1['0']['Item']['id'];
            //$LeftPrdId[1]=$ItemArrright['0']['Item']['itemname'];
            $LeftPrdId[1]=$ItemArrright1['0']['Itemslng']['slug_itemname'];
            //$LeftPrdId[1]=$ItemArrright['0']['Items']['slug_itemname'];
         }
      $this->set('LeftPrdId', $LeftPrdId);
  
      
      
      
      
      
      
      $this->loadModel("Itemcolor");
      $strcon="removed='N' and itemid='$id'  and lngid='$lngid' order by id desc";
      $MatchColor = $this->Itemcolor->findAll($strcon);
      $this->set('MatchColor', $MatchColor);
      
      $this->loadModel("Productsmartshop");
      //$ProductnewArr = $this->Productsmartshop->find('all', array('fields' => array('DISTINCT colorid'),'conditions' => array('itemid' => $id)));
      $ProductnewArr = $this->Productsmartshop->find('all', array('fields' => array('DISTINCT colorid'),'conditions' => array('itemid' => $id)), array('cache' => 'Productsmartshop', 'cacheConfig' => 'long'));
      $this->set('ProductnewArr', $ProductnewArr);
     
      
      $this->loadModel("Itemfebric");
      $MatchFebric = $this->Itemfebric->findAll($strcon);
      $this->set('MatchFebric', $MatchFebric);
      
      $this->loadModel("Itemoccasion");
      $MatchOccasion= $this->Itemoccasion->findAll($strcon);
      $this->set('MatchOccasion', $MatchOccasion);
      
      
      
      $this->loadModel("Itemspecialtag");
      $MatchSpecialTag= $this->Itemspecialtag->findAll($strcon);
      $this->set('MatchSpecialTag', $MatchSpecialTag);
      
      $this->loadModel("Accessory");
      $strcon1="item_id='$id' ";
      /*$MatchAccessories= $this->Productassry->findAll($strcon1);
      $this->set('MatchAccessories', $MatchAccessories);*/
     
     # $MatchAccessories = $this->Accessory->find("all",array("joins"=>array('table' => 'productassries',
                                                                           # 'type' => 'inner',
                                                                           # 'foreignKey' => false,
                                                                           # 'conditions'=> array('Accessory.id=productassries.assr_id')
                                                                        # ),
                                                            # "fields"     => array('id','accrcode','defaultqty','inputdefprice','defprice'),
                                                            # "conditions" => array('productassries.item_id'=>$id)
                                                            # )
                                                # );
      $MatchAccessories = $this->Accessory->find("all",array("joins"     =>array("INNER JOIN productassries as Productassry ON Productassry.assr_id = Accessory.id"),
                                                            "fields"     => array('id','accrcode','defaultqty','inputdefprice','defprice','spicalacc'),
                                                            "conditions" => array('Productassry.item_id'=>$id), array('cache' => 'MatchAccessories', 'cacheConfig' => 'long')
                                                            )
                                                );
      
  
     $this->set('MatchAccessories', $MatchAccessories);
      
      
      $this->loadModel("Itemsmeasurmenttag");
      $MatchMeasurtag= $this->Itemsmeasurmenttag->findAll($strcon);
      $this->set('MatchMeasurtag', $MatchMeasurtag);
      
      $this->loadModel("Itemmaterial");
      $MatchMaterial= $this->Itemmaterial->findAll($strcon);
      $this->set('MatchMaterial', $MatchMaterial);
      
      $this->loadModel("Itemreadymadesize");
      //$MatchReadymadeSize = $this->Itemreadymadesize->find("list",array("fields"=>array('SizeId','sizename'),"conditions" =>array('AND' =>array('ItemId'=>$id))));
      $MatchReadymadeSize = $this->Itemreadymadesize->find('list',array("fields"=>array('SizeId','sizename'),"conditions" =>array('AND' =>array('ItemId'=>$id))), array('cache' => 'Itemreadymadesize', 'cacheConfig' => 'long')); 
      $this->set('MatchReadymadeSize', $MatchReadymadeSize);
      
     // $strcon1="removed='N' and itemid='$id' and lngid='$lngid'";
      
     /* $this->loadModel("Itemrelative");
      $MatchOtherProduct= $this->Itemrelative->find('all',
                                                   array(
                                                         'fields'=>array('id','itemcode','smalling','bigimg','xname','itemid','slug_itemname'),
                                                         'conditions' => array('AND' => array('removed' => 'N','lngid'=>$lngid,'itemid'=>$id))
                                                         ,'limit'=>2,'recursive' => 0));
          $this->set('MatchOtherProduct', $MatchOtherProduct);                                                 
      
      $this->loadModel("Testimonal");
      $TestimonalArr = $this->Testimonal ->find('all', array('conditions' => array('Testimonal.removed' => 'N','Testimonal.approved'=>'Y'),'order' => 'rand()','limit'=>'1'));
    
   
      */
      
      $this->loadModel("Shippingitem");
      
      $shippingdaysArr = $this->Shippingitem->find("all",array("conditions" =>array('ItemId'=>$id)));
      $this->set('shippingdaysArr', $shippingdaysArr);
      
      /*
      $testimonaltitle="";
      $postby="";
      $testmetter="";
      
      $this->loadModel("Testimonalview");
      $TestimonalArr = $this->Testimonalview ->find('all', array("fields"=>array("distinct Testimonalview.id,Testimonalview.testimonaltitle,Testimonalview.testmetter,Testimonalview.postby"),'conditions' => array('removed' => 'N','itemid'=>$id,'approved'=>'Y'),'order' => 'rand()','limit'=>'1'));
      if(count($TestimonalArr)>0)
         {
           $TestimonalArr=$TestimonalArr[0];
           foreach($TestimonalArr as $key => $value)
            {
               $testimonalid=$value['id'];
               $testimonaltitle=$value['testimonaltitle'];
               $testmetter=$value['testmetter'];
               $postby=$value['postby']; 
            }
         }
         else
         {
          $TestimonalArr = $this->Testimonalview ->find('all', array('conditions' => array('removed' => 'N','approved'=>'Y'),'order' => 'rand()','limit'=>'1'));
          if(count($TestimonalArr)>0)
            {
               $TestimonalArr=$TestimonalArr[0];
               foreach($TestimonalArr as $key => $value)
                 {
                   $testimonalid=$value['id'];
                   $testimonaltitle=$value['testimonaltitle'];
                   $testmetter=$value['testmetter'];
                   $postby=$value['postby'];
                 }
            }
         }
         $this->set('testimonaltitle', $testimonaltitle);
         $this->set('postby', $postby);
         $this->set('testmetter', $testmetter);*/
   }
   Function checksize($ItemId,$ItemName)
    {
      $sPageTitle = "InMonarch-checksize";
      $this -> set('sPageTitle',$sPageTitle);
      $this -> set('labelname',"Home > Check Size");
      $this->commonfunctions->funsiteRuninIndia();
      $lngid = PROGRAMLANGUAGE;
      
          $this->Set('ItemId',$ItemId);
          
          $ItemArr = $this->Item->find('all', 
                                       array(
                                            'conditions' => array('removed' => 'N','Item.id'=>$ItemId,'lngid'=>$lngid),
                                            'order' => array('gorder')
                                            ));
          $this->set('ItemArr', $ItemArr);
          
          $itemcode=$ItemArr['0']['Item']['itemcode'];
          $this->set('itemcode', $itemcode);
          $itemname=$ItemArr['0']['Itemslng']['itemname'];
          $this->set('itemname', $itemname);
          $figration=$ItemArr['0']['Item']['figration'];
          $this->set('figration', $figration);
          $istand=$ItemArr['0']['Item']['istand'];
          $this->set('istand', $istand);
          $servanifeatures=$ItemArr['0']['Item']['servanifeatures'];
    	  $this->set('servanifeatures', $servanifeatures);
          $this->loadModel("Itemsmeasurmenttag");
          $Itemsmeasurmenttag =$this->Itemsmeasurmenttag->find("all",array("conditions" => array('AND' => array('removed' => 'N','lngid'=>$lngid,'itemid'=>$ItemId))));
          $this->set('Itemsmeasurmenttag', $Itemsmeasurmenttag);
          
    }
   function orderform()
   {
      $sPageTitle = "InMonarch-Orderform";
      $this -> set('sPageTitle',$sPageTitle);
      $this -> set('labelname',"Home > Order Form");
      $this->commonfunctions->funsiteRuninIndia();
      $lngid = PROGRAMLANGUAGE;
      
      $transferfrom=$_POST['transferfrom'];
      if($transferfrom=="product")
      {
          
          $ItemId=$_POST['ItemId'];
          $this->Set('ItemId',$ItemId);
          $ShippingPrice=$_POST['ShippingPrice'];
          $this->Set('ShippingPrice',$ShippingPrice);
          $febricsel=$_POST['febricsel'];
          $this->Set('febric',$febricsel);
          
          $ColorSel=$_POST['ColorSel'];
          $this->Set('color',$ColorSel);
            $price=$_POST['price'];
          $this->Set('price',$price);
            $quantity=$_POST['quantity'];
          $this->Set('quantity',$quantity);
          /*
              $ShippingPrice
              $price
              $quantity
              
          */
          $itemname=$_POST['itemname'];
          $this->Set('itemname',$itemname);
          $itemcode=$_POST['itemcode'];
          $this->Set('itemcode',$itemcode);
          
          $shipingdays=$_POST['data']['Product']['shipingdays'];
          $this->Set('shipingdays',$shipingdays);
          if(isset($_POST['chkcustomsize']))
            {
                $chkcustomsize=$_POST['chkcustomsize'];
                $defsize="";
            }
          else
            {
                $chkcustomsize='N';
                $defsize=$_POST['data']['Product']['defsize'];
            }
          $this->Set('defsize',$defsize);
          $this->Set('chkcustomsize',$chkcustomsize);
          
          $Accessories=$_POST['Accessories'];
            $this->Set('Accessories',$Accessories);
          $AccessoriesQty=$_POST['AccessoriesQty'];
            $this->Set('AccessoriesQty',$AccessoriesQty);
          $AccessoriesPrice=$_POST['AccessoriesPrice'];
            $this->Set('AccessoriesPrice',$AccessoriesPrice);
          
          $ItemArr = $this->Item->find('all', 
                                       array(
                                            'conditions' => array('removed' => 'N','Item.id'=>$ItemId,'lngid'=>$lngid),
                                            'order' => array('gorder')
                                            ));
          $this->set('ItemArr', $ItemArr);
          
          $figration="Y";//$ItemArr['0']['Item']['figration'];
          $this->set('figration', $figration);
          $istand="Y";//$ItemArr['0']['Item']['istand'];
          $this->set('istand', $istand);
          $servanifeatures="Y";//$ItemArr['0']['Item']['servanifeatures'];
    	  $this->set('servanifeatures', $servanifeatures);
          
          $this ->Item->recursive = -1;
          $this->loadModel("Itemcolor");
          $MatchColor = $this->Itemcolor -> find("list",array( "fields"=> array('id','xname'),"conditions" => array('AND' => array('removed' => 'N','lngid'=>$lngid,'itemid'=>$ItemId))));
          $this->set('MatchColor', $MatchColor);
          $this->set(compact('MatchColor'));
          $this->loadModel("Itemfebric");
          $MatchFebric = $this -> Itemfebric -> find("list",
                                                    array( "fields"=> array('id','xname'),
                                                    "conditions" => array('AND' => array(
                                                                                         'removed' => 'N',
                                                                                         'lngid'=>$lngid,
                                                                                         'itemid'=>$ItemId)
                                                                                         )
                                                    ));
     
          $this->set('MatchFebric', $MatchFebric);
          $this->loadModel("Itemreadymadesize");
          $MatchReadymadeSize = $this -> Itemreadymadesize -> find("list",
                                                    array( "fields"=> array('id','xname'),
                                                    "conditions" => array('AND' => array(
                                                                                         'removed' => 'N',
                                                                                         'item_id'=>$ItemId)
                                                                                         )
                                                    ));
          $this->set('MatchReadymadeSize', $MatchReadymadeSize);
          
          
          $this->loadModel("Itemsmeasurmenttag");
          $Itemsmeasurmenttag = $this -> Itemsmeasurmenttag -> find("all",
                                                    array(
                                                    "conditions" => array('AND' => array(
                                                                                         'removed' => 'N',
                                                                                         'lngid'=>$lngid,
                                                                                         'itemid'=>$ItemId)
                                                                                         )
                                                    ));
          $this->set('Itemsmeasurmenttag', $Itemsmeasurmenttag);
          
          
          $dayofdob=Array();
          for($i=1;$i<=31;$i++)
            {$dayofdob[]=$i;}
          $this->set('dayofdob', $dayofdob);
          
          $monthofdob=Array();
          for($i=1;$i<=12;$i++)
            {$monthofdob[]=$i;}
          $this->set('monthofdob', $monthofdob);  
      }
      elseif($transferfrom=="order")
      {
        pr($_POST);
      }
    }
   function customdesign($Id=null,$oren2=null)
    {
       $vikas = $_SESSION['CompanyDetail']['companyname'];
		   $vyas  = $_SESSION['CompanyDetail']['email'];
      $this->set('vikas', $vikas);
      $this->set('vyas', $vyas);
      
      $this->commonfunctions->funsiteRuninIndia();
      $lngid = PROGRAMLANGUAGE;
      
      if($Id!='r'){
         $MaincategoryArr = $this->Maincategory->find('all',array('conditions' => array('removed' => 'N','id'=>$Id,'lngid'=>$lngid)));
         $this->set('MaincategoryArr', $MaincategoryArr);
      
      
         $maincatname=$MaincategoryArr[0]['Maincategory']['maincatname'];
         $this->set('maincatname', $maincatname);
         
         $sPageTitle = "Paridhan-Custom design for $maincatname";
         $this -> set('sPageTitle',$sPageTitle);
         $this -> set('labelname',"Custom Design : $maincatname");
         
         $this->set('Id', $Id);
         
         $this->loadModel('Category');
         $arrCategory= $this -> Category-> find("list",array( "fields"=> array('id','childcatname'),"conditions" => array('AND' => array("maincatid"=>$Id,'removed' => 'N'))));
         $this->set("arrCategory",$arrCategory);
      }else{
         $sPageTitle = "Paridhan-Custom design";
         $this -> set('sPageTitle',$sPageTitle);
         $this -> set('labelname',"Order for custom design");
      }
      
      if($oren2=="")$oren2=0;      
      $this->set('oren2', $oren2);
      
      $this->loadModel('Companydetail');
      $companyemail =  $this->Companydetail->find("list",array("fields"=>'email'));
      
       
      $this->loadModel('Country');
      $arrcountry= $this -> Country-> find("list",array( "fields"=> array('cname','cname'),"conditions" => array('AND' => array('removed' => 'N')),"order"=> array('cname')));
      $this->set("arrcountry",$arrcountry);
     
      if(!empty($this -> data)){
      	//$privatekey = '6LdjvOASAAAAABq9m7SzUgmDpxlgD9gkJKyVtOki';
      	
          	$resp = recaptcha_check_answer($this->privatekey,
                                        $_SERVER["REMOTE_ADDR"],
                                        $_POST["recaptcha_challenge_field"],
                                        $_POST["recaptcha_response_field"]);

        	if(!$resp->is_valid) {
        		//echo $error = $resp->error;exit;
        		$this->Session->setFlash('Invalid security answer.',true);
        		$this->redirect(array('customdesign/1'));
        	}
      	
            $fullname = $this->data['Product']['fullname'];
            $emailaddress= $this->data['Product']['emailaddress'];
            $url= $this->data['Product']['url'];
            $country= $this->data['Product']['country'];
            //$country= $this->data['Product']['category'];
           // $category= $this->data['Product']['category'];
            $city = $this->data['Product']['city'];
            $phone = $this->data['Product']['phone'];
            $uploadtype = $_POST["uploadtype"];
            $requirements=$_POST["requirements"];
            
            $image=$this->data['Product']['image']['name'];
            $maincatimg=$image;
                $imagepath=WWW_ROOT."products/customdesign/$maincatimg";
                
                if (!copy($this->data['Product']['image']['tmp_name'], $imagepath)) 
                {$notsavedata=1;} 
                           $imagepathnew="products/customdesign/$maincatimg";
            //$Id=$this->data['Product']['Id'];
            //$oren2=$this->data['Product']['oren2'];
            $ValdtSmallIng = $this->commonfunctions->ValdateImageFile($this->data['Product']['image']);
            //$imagepath=$image;
             
             # if($ValdtSmallIng==0)
                # {
                  # $this->Session->setFlash('invalid image file.',true);
                  # $this->redirect("/products/customdesign/$Id/$oren2");
                # }
               
              # else
                # {
                  # $SmallIngfile = $this ->commonfunctions->uploadFiles("d", $this->data['Product']['image'], "customdesign");
                  # $imagepath=WWW_ROOT."products/customdesign/$SmallIngfile";
                 # // $mgsize=$commonfunction->funretimagesize($imagepath,150);
                # }
              $oren2=2;
              $this->set('oren2', $oren2);
                       
            $style1="style='font-family:Verdana;vertical-align:top; font-size:10pt; color:#800000; vertical-align:top; font-weight:bold' align='left' height='30'";
            $style21="style='font-family:Verdana;vertical-align:top; font-size:10pt; color:#800000; vertical-align:top; font-weight:bold' align='left' height='30'";
            $style12="style='font-family:Verdana;vertical-align:top;text-align:left; font-size:10pt; color:#5086ff; vertical-align:top; font-weight:bold'  height='30'";
            $style2="style=' font-family:Verdana;vertical-align:top; font-size:10pt; color:#000000;text-transform:uppercase' height='25'";
            $orderbody="";
            $orderbody="
"; if($uploadtype==1) {$orderbody=$orderbody."";} $orderbody=$orderbody."
Your custom design details are as follows:
".__('your_full_name',true)."".$this->data['Product']['fullname']."
".__('email_address',true)."".$this->data['Product']['emailaddress']."
".__('country',true)."".$this->data['Product']['country']."
".__('city',true)."".$this->data['Product']['city']."
".__('phone_number',true)."".$this->data['Product']['phone']."
Your requirements$requirements
".__('url',true)."".$this->data['Product']['url']."
"; /*$this->Email->from = $emailaddress; $this->Email->fromName=$fullname; $this->Email->to=$companyemail[1]; $this->Email->toName=COMPANYNAME; $this->Email->subject = "Request for custom design"; $this->Email->html_text = $orderbody; $this->Email->html_body = $orderbody; */ $to = COMPANYEMAIL; $subject = "Request for custom design Form ".$emailaddress; $message = $orderbody; $mail = $this->Email->send($to,$subject,$message,$imagepathnew); // You can attach as many files as you like. // $result = $this->Email->send(); unlink($imagepathnew); } } Function enquiry($ItemId,$slug_name) { $this->layout="layoutblank"; $sPageTitle = "InMonarch-Products Enquiry"; $this -> set('sPageTitle',$sPageTitle); $this->commonfunctions->funsiteRuninIndia(); $lngid = PROGRAMLANGUAGE; $this->Set('ItemId',$ItemId); $this->Set('ItemName',$ItemName); $ItemArr = $this->Item->find('all', array( 'conditions' => array('removed' => 'N','Item.id'=>$ItemId,'lngid'=>$lngid))); $this->set('ItemArr', $ItemArr); $ItemName=$ItemArr[0]['Item']['itemname']; $this -> set('labelname',"$ItemName > Enquiry"); if(!empty($this->data)) { /*echo "
";
            print_r($this->data);
            echo $this->Session->read('captcha');
            echo $_REQUEST['seccode'];
            exit;*/
            
              if($_REQUEST['seccode']!=$this->Session->read('captcha'))
               {
                  $this->Session->setFlash(__('Please enter correct captcha code and try again.'));
               }else{
             
               /*if($this->data['Product']['ver_code']==$this->Session->read('ver_code'))
               {*/
                  $itemcode=$ItemArr[0]['Item']['itemcode'];
                  $itemname=$ItemArr[0]['Itemslng']['itemname'];
                  $item_slug=$ItemArr[0]['Itemslng']['slug_itemname'];
                  $itemdesc=$ItemArr[0]['Itemslng']['itemdesc'];
                  $itemdesc= $this->funremovechr12($itemdesc);  
                  $yourname=$this->data['Product']['yourname'];
                  $youremail=$this->data['Product']['youremail'];
                  $comments=$this->data['Product']['comments'];
                  $yourphone=$this->data['Product']['yourphone'];
                  
                  $txtmaterclass="style='font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;color:#000000;line-height:160%;padding:2px 8px 0px 8px;text-align:left;'";
                  $strmetter="
".__('itemcodename',true)." : $itemcode $itemname
".__('description',true)." : $itemdesc
View: $itemname
".__('comments',true).": $comments
".__('sender_name',true)." : $yourname
".__('sender_email',true)." : $youremail
".__('phone_number',true)." : $yourphone
"; /* $this->Email->from = "sharad@ecybertech.com";//COMPANYEMAIL $this->Email->fromName=COMPANYNAME; $this->Email->to=$youremail; $this->Email->toName=$yourname; $this->Email->subject = "Producut enquiry from InMonarch for $itemname ($itemcode $itemname)"; $this->Email->html_text = $strmetter; $this->Email->html_body = $strmetter; $result = $this->Email->send(); $result = $this->Email->smtp_send($smtpArray); $this->Email->to = "sharad@ecybrtech.com";//COMPANYEMAIL $this->Email->toName=COMPANYNAME; $this->Email->from=$youremail; $this->Email->fromName=$yourname; $this->Email->subject = "Product enquiry from $yourname ($youremail) for $itemname ($itemcode $itemname)"; $this->Email->html_text = $strmetter; $this->Email->html_body = $strmetter; $result = $this->Email->send();*/ $to = $youremail; $subject = "Producut enquiry from InMonarch for $itemname ($itemcode $itemname)"; $message = $strmetter; $mail = $this->Email->send($to,$subject,$message); $to = COMPANYEMAIL; $subject = "Producut enquiry from InMonarch for $itemname ($itemcode $itemname)"; $message = $strmetter; $mail = $this->Email->send($to,$subject,$message); $this->Session->write('thanksmessage', __('message_sucessfully_sent_our_team_member_contact_you_soon',true)); $this->redirect(array('controller' => 'products', 'action' => 'fullpage',$ItemId,$item_slug)); } /*} else { $this->Session->write('ClientUsererror', "Captcha verification failure"); //$this -> redirect ("../products/enquiry/$ItemId/$ItemName"); if($Errormessage!=""){$this->Session->destroy('ClientUsererror');} }*/ } /*$this->create_captcha(); //not form action performed, create a captch code and show the form $this->render();*/ } function checkcod() { $this->layout="layoutblank"; $sPageTitle = "InMonarch-Send to friend"; $this -> set('sPageTitle',$sPageTitle); $this->commonfunctions->funsiteRuninIndia(); $lngid = PROGRAMLANGUAGE; } function getcodnumber() { $this->layout=""; $this->loadModel("Citypincode"); $pincode=$_REQUEST['pincode']; //$febriccolor=$this->Febric->find('all','conditions' => array('febricid'=>$itemid))); $PincodeArr = $this->Citypincode->find('all',array('conditions' => array('pincode'=>$pincode))); $this->set('PincodeArr',$PincodeArr); $this->set('Pincodesubmit',$pincode); } Function senttofriend($ItemId,$slug_itemname) { $this->layout="layoutblank"; $sPageTitle = "InMonarch-Send to friend"; $this -> set('sPageTitle',$sPageTitle); $this->commonfunctions->funsiteRuninIndia(); $lngid = PROGRAMLANGUAGE; $this->Set('ItemId',$ItemId); $this->Set('ItemName',$ItemName); $ItemArr = $this->Item->find('all', array( 'conditions' => array('removed' => 'N','Item.id'=>$ItemId,'lngid'=>$lngid))); $this->set('ItemArr', $ItemArr); $ItemName=$ItemArr[0]['Item']['itemname']; $this -> set('labelname',"$ItemName > send to friend"); if($_REQUEST['seccode']!=$this->Session->read('captcha')) { $this->Session->setFlash(__('Please enter correct captcha code and try again.')); }else{ $itemcode=$ItemArr[0]['Item']['itemcode']; $itemname=$ItemArr[0]['Itemslng']['itemname']; $itemdesc=$ItemArr[0]['Itemslng']['itemdesc']; $item_slug=$ItemArr[0]['Itemslng']['slug_itemname']; $itemdesc= $this->funremovechr12($itemdesc); $yourname=$this->data['Product']['yourname']; $youremail=$this->data['Product']['youremail']; $friendname=$this->data['Product']['friendname']; $friendemail=$this->data['Product']['friendemail']; $comments=$this->data['Product']['comments']; $txtmaterclass="style='font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;color:#000000;line-height:160%;padding:2px 8px 0px 8px;text-align:left;'"; $strmetter="
".__('itemcodename',true)." : $itemcode $itemname
".__('description',true)." : $itemdesc
View: $itemname
".__('comments',true).": $comments
This is Referred to you by (Name): $yourname
This is Referred to you by (Email) : $youremail
"; $yourname=$this->data['Product']['yourname']; $youremail=$this->data['Product']['youremail']; $friendname=$this->data['Product']['friendname']; $friendemail=$this->data['Product']['friendemail']; /* $this->Email->from = $youremail; $this->Email->fromName=$yourname; $this->Email->to=$friendemail; $this->Email->toName=$friendname; $this->Email->subject = "InMonarch Product for $itemname ($itemcode $itemname)"; $this->Email->html_text = $strmetter; $this->Email->html_body = $strmetter; //$this->Email->attach($fully_qualified_filename, optionally $new_name_when_attached); $result = $this->Email->send();*/ /*$sender = "sharad@ecybertech.com"; // this will be overwritten by GMail $header = "X-Mailer: PHP/".phpversion() . "Return-Path: $sender"; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "smtp.gmail.com"; $mail->SMTPAuth = true; $mail->SMTPSecure = "tls"; $mail->Port = 587; $mail->SMTPDebug = 2; // turn it off in production $mail->Username = "sharad@ecybertech.com"; $mail->Password = "qaz123wsx"; $mail->authentication= 'plain'; $mail->From = $sender; $mail->FromName = "From Me"; $to ='bohra.sharad@gmail.com'; $mail->AddAddress($to); $mail->IsHTML(true); $mail->CreateHeader($header); $mail->Subject = "InMonarch Product for $itemname ($itemcode $itemname)"; $mail->Body = nl2br($strmetter); $mail->AltBody = nl2br($strmetter); // return an array with two keys: error & message if(!$mail->Send()) { return array('error' => true, 'message' => 'Mailer Error: ' . $mail->ErrorInfo); } else { return array('error' => false, 'message' => "Message sent!"); }*/ $form = $youremail; $to = $friendemail; $subject = "InMonarch Product for $itemname ($itemcode $itemname)"; $message = $strmetter; $mail = $this->Email->send($to,$subject,$message); if($mail['message']=='Message sent!') {$this->Session->write('thanksmessage', __('message_sucessfully_sent',true));} $this->redirect(array('controller' => 'products', 'action' => 'fullpage',$ItemId,$item_slug)); } //$this->create_captcha(); //not form action performed, create a captch code and show the form //$this->render(); } Function size($sizeimagename) { $sPageTitle = "ParidhanIn-checksize"; $this -> set('sPageTitle',$sPageTitle); $this->layout="layoutblank"; $this->commonfunctions->funsiteRuninIndia(); $lngid = PROGRAMLANGUAGE; if(!empty($sizeimagename)){ $idt = @explode('_',$sizeimagename); $id = $idt[1]; $sizeimage = 'img/Size.jpg'; if($idt[0]=='s'){ $query = "select sizeimage from subcategory where id='".$id."'"; $result = @mysql_query($query); $row = @mysql_fetch_assoc($result); $sizeimage= $row['sizeimage']; if(!empty($row['sizeimage'])){ $sizeimage="products/subcategoryimage/".$row['sizeimage']; } }else if($idt[0]=='c'){ $query = "select sizeimage from childcategory where id='".$id."'"; $result = @mysql_query($query); $row = @mysql_fetch_assoc($result); $sizeimage= $row['sizeimage']; if(!empty($row['sizeimage'])){ $sizeimage="products/categoryimage/".$row['sizeimage']; } } } /*$Sizeavailable=$this->Sizeavailable->find('all',array('conditions' => array('removed' => 'N'))); $this->Set('Sizeavailable',$Sizeavailable); $this->Set('ItemName',$ItemName); */ $this->Set('sizeimage',$sizeimage); } Function pageconforme() { $this->layout=""; $this->commonfunctions->funsiteRuninIndia(); $lngid = PROGRAMLANGUAGE; $sPageTitle = "InMonarch"; $this -> set('sPageTitle',$sPageTitle); if(!empty($_REQUEST['Mode'])) { if($_REQUEST['Mode']=='Save') { $AllSaveData['CloseSuggestion']['product_url'] = $_REQUEST['product_url']; $AllSaveData['CloseSuggestion']['product_search'] = $_REQUEST['product_search']; $AllSaveData['CloseSuggestion']['suggestion'] = $_REQUEST['suggestion']; $AllSaveData['CloseSuggestion']['close_reason'] = $_REQUEST['close_reason']; $AllSaveData['CloseSuggestion']['currentdate'] = date('Y-m-d'); app::import('Model','CloseSuggestion'); $CloseSuggestion = new CloseSuggestion(); $CloseSuggestion->create(); if($CloseSuggestion->save($AllSaveData)) { e(''); } } } } function getClose() { e(''); } Function color($ItemId,$ItemName) { $sPageTitle = "InMonarch-color"; $this -> set('sPageTitle',$sPageTitle); $this->layout="layoutblank"; $this->commonfunctions->funsiteRuninIndia(); $lngid = PROGRAMLANGUAGE; /* $Sizeavailable=$this->Sizeavailable->find('all',array('conditions' => array('removed' => 'N'))); $this->Set('Sizeavailable',$Sizeavailable); $this->Set('ItemName',$ItemName); $this->Set('ItemId',$ItemId); */ $this->Set('ItemName',$ItemName); $this->loadModel("Itemcolor"); $strcon="removed='N' and itemid='$ItemId' and lngid='$lngid'"; $MatchColor = $this->Itemcolor->findAll($strcon); $this->set('MatchColor', $MatchColor); } Function addtowishlist($ItemId,$ItemName) { $this->layout="layoutblank"; $sPageTitle = "InMonarch-(".__('add_to_wish_list',true).")"; $this -> set('sPageTitle',$sPageTitle); $this -> set('labelname',"$ItemName > ".__('add_to_wish_list',true)); $this->commonfunctions->funsiteRuninIndia(); $lngid = PROGRAMLANGUAGE; $this->Set('ItemId',$ItemId); $this->Set('ItemName',$ItemName); $liginId=$_SESSION['ClientUser']['refid']; $ItemWishListArr=$this->Addtowishlist->find('all', array('conditions' => array('removed' => 'N','item_id'=>$ItemId,'client_id'=>$liginId))); if(count($ItemWishListArr)==0) { $this->Addtowishlist->create(); $this->data['Addtowishlist']['client_id'] = $liginId; $this->data['Addtowishlist']['item_id'] = $ItemId; $this->data['Addtowishlist']['removed'] = "N"; $this->Addtowishlist->save($this->data); $datainsert=false; } else {$datainsert=true;} $this->Set('datainsert',$datainsert); $ItemArr = $this->Item->find('all',array('conditions' => array('removed' => 'N','Item.id'=>$ItemId,'lngid'=>$lngid))); $this->set('ItemArr', $ItemArr); $itemcode=$ItemArr[0]['Item']['itemcode']; $itemname=$ItemArr[0]['Itemslng']['itemname']; $itemdesc=$ItemArr[0]['Itemslng']['itemdesc']; } function create_captcha() { App::import("Component","Captcha"); //including captcha class $this->Captcha = new CaptchaComponent(); //creating an object instance $this->Captcha->controller = & $this; //assign this conroller(CaptchaController) object to its captcha object's controller property. $this->set('captcha_src',$captcha_src=$this->Captcha->create()); //create a capthca and assign to a variable } function funremovechr12($Instruction) { $Instruction = str_replace("\r\n", "", $Instruction); $Instruction=htmlspecialchars_decode($Instruction, ENT_QUOTES); return $Instruction; } function getcolorsfeb() { $this->layout=""; $this->loadModel("Febriccolo"); $febid=$_REQUEST['febid']; //$febriccolor=$this->Febric->find('all','conditions' => array('febricid'=>$itemid))); $ProductsArr = $this->Febriccolo->find('all',array('conditions' => array('febricid'=>$febid))); $this->set('ProductsArr',$ProductsArr); /* $ProductsArr = $this->Febriccolo->find('all', array( 'fields' => array('colorid',' xname','code','colorimg','colorsmall','colortiny'), 'joins'=>array( array( 'table' => 'colors', 'alias' => 'Color', 'type' => 'inner', 'foreignKey' => false, 'conditions'=> array('febriccolors.colorid=colors.id') ) ), 'conditions' => array('febriccolors.febricid'=> $febid) ) ); */ } function getcolorscombofeb() { $this->layout=""; $this->loadModel("Febriccolo"); $febid=$_REQUEST['febid']; $colorid1=$_REQUEST['colorid1']; //$febriccolor=$this->Febric->find('all','conditions' => array('febricid'=>$itemid))); $ProductsArr = $this->Febriccolo->find('all',array('conditions' => array('febricid'=>$febid))); $this->set('ProductsArr',$ProductsArr); $this->set('colorid1',$colorid1); } function searchallitems(){ $this->layout = 'ajax'; $term = $_REQUEST['term']; $this->loadModel('Item'); $item_data = $this->Item->find( 'all', array( 'fields' => array( 'Item.id','Item.itemname' ), 'conditions' => array( 'OR' => array( 'Item.itemname like "%'.$term.'%"', 'Item.itemcode like "%'.$term.'%"', 'Itemslng.itemnote like "%'.$term.'%"', 'Itemslng.itemdesc like "%'.$term.'%"', ), 'Item.removed' => 'N', 'Item.dissapprove' => 'Y' ),'limit' => 10 ) ); if(!empty($item_data)){ $item_arr = array(); foreach($item_data as $key => $arr){ $item_id = $arr['Item']['id']; $item_name = $arr['Item']['itemname']; //$item_arr[$key]['id'] = $item_id; //$item_arr[$key]['value'] = $item_name; $item_arr[$key]= $item_name; } } echo json_encode($item_arr); exit; //$this->set('item_arr',$item_arr); } } ?>