using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using UnityEngine; public class BasketUrl : MonoBehaviour { public void Go() { print("----Set shopify------"); //string url="https://www.kwizineenstock.ca/en/cart/"; string url= "" ; //p=0002034:555&p=0002043:555&p=0002052:555&ronaStore=41460 if(_G.PATH=="collection_elite")url="https://wwwppr.rona.ca/en/shared-cart?"; // string Code_ID=""; // string Variant_ID=""; // string Ecommerce_ID=""; // CameraAround.Show(); List Cablist=DOLIST.CABLISTint(); Dictionary CABdict = MakeList.CABLISTQTY(Cablist); Dictionary PNLdict = MakeList.PNLLISTQTY(); Dictionary KICKdict = MakeList.KICKLISTQTY(Cablist); Dictionary VALANCEdict = MakeList.VALANCELISTQTY(); Dictionary FASCIAdict = MakeList.FASCIAQTY(); Dictionary FILLERdict = MakeList.FILLERQTY(Cablist); // Dictionary OGEEdict = MakeList.OGEELISTQTY(); // Dictionary HEADdict = MakeList.HEADLISTQTY(); // Dictionary UNDERdict = MakeList.UNDERLISTQTY(); // Dictionary KNOBdict = MakeList.KNOBLISTQTY(); // Dictionary SRECOVERPANELdict = MakeList.RECOVERPANELISTQTY(); url+=AddtoURLCabinet(CABdict); url+=AddtoURLPanel(PNLdict); url+=AddtoURLMolding(KICKdict); url+=AddtoURLMolding(VALANCEdict); url+=AddtoURLMolding(FASCIAdict); url+=AddtoURLMolding(FILLERdict); //_M.PH(29,0, "ffffff", 1, 1); if(url!="https://wwwppr.rona.ca/en/shared-cart?") { url+="ronaStore="+_G.StoreCode; Link.OpenWindow("btnBasket",url); } else{_M.PH(29,0, "ffffff", 1, 1);} //url========https://wwwppr.rona.ca/en/shared-cart? //else{_M.PH(29,0, "ffffff", 1, 1);} //https://wwwppr.rona.ca/en/shared-cart?p=:1& print("url========"+url);//url========https://wwwppr.rona.ca/en/shared-cart?p=75396486:1&ronaStore=08660 print("StoreSelect===="+_G.StoreSelect+" Code: "+_G.StoreCode);//StoreSelect====RONA Fraser Valley / 100 Mile House Code: 08660 //https://wwwppr.rona.ca/en/shared-cart?p=0002034:1&ronaStore=41460 //works //https://wwwppr.rona.ca/en/shared-cart?p=75396598:1&ronaStore=41460 } public static string AddtoURLCabinet(Dictionary dict){ string urlplus=""; string Code_ID; foreach (KeyValuePair pair in dict) { //From Cabinet List print("Shopify pair.Key cab==="+pair.Key);//ES-MWN2715 ? W27 ''x H15 ''x D12 3/4'' ? NO_DOOR ? 7?Kitchen microwave wall open cabinet?1_1_1_1_1_1_1?F print("pair.Value==="+pair.Value); string[] code=pair.Key.Split('?'); string Boxname=code[0].Replace("_G","").Replace("_L","").Trim(); if(Boxname[..1] == " ")Boxname=Boxname[1..]; string DoorUniqueName=UIT.Value(Library.Door,code[2],Header.Unique_Name); if(_P.ListSwitch["CABINET_BY_MODEL_DOOR"]){ Boxname=UIT.GetCabPriceCode_ID(Boxname,"",DoorUniqueName,""); } //Door string PriceID=Boxname+"-"+DoorUniqueName; int indCUP=4; string qty=pair.Value.Split('?')[0]; print("PriceID============================="+PriceID);//PriceID=============================RD-B18-1 //Index int indCode_ID=UIT.Ind(Library.Price,Header.Code_ID); //Check on price list for(int i=1; i<_G.UIT_LibraryPrices.Count; i++){ if(!string.IsNullOrEmpty(_G.UIT_LibraryPrices[i])){ string[] line=_G.UIT_LibraryPrices[i].Split(','); Code_ID=line[indCode_ID];//RD-B36.SD if(Code_ID==PriceID ) { urlplus+="p="+line[indCUP]+":"+qty+"&"; } } } } return urlplus; } public static string AddtoURLPanel(Dictionary PNLdict){ string urlplus=""; string Code_ID; foreach (KeyValuePair pair in PNLdict) { //From Panel List string[] CODE = pair.Key.Split('?'); print("pair.Key=====U===="+pair.Key);//pair.Key=====U====3?1?0.75 //Index int indCode_ID=UIT.Ind(Library.Price,Header.Code_ID); string PanelUniqueName=UIT.Value(Library.Panel,CODE[0],Header.Unique_Name).Trim();//1 string ColorUniqueName=UIT.Value(Library.CabTexture,CODE[1],Header.Unique_Name);//1 string qty=pair.Value.ToString();//1 string PriceID=PanelUniqueName+"-"+ColorUniqueName; int indCUP=4; print("PriceID==============P===="+PriceID);//PriceID=============================RD-B36-SD //PriceID==============P====RD_PANDW-SD //Check on price list for(int i=1; i<_G.UIT_LibraryPrices.Count; i++) { if(!string.IsNullOrEmpty(_G.UIT_LibraryPrices[i])){ string[] line=_G.UIT_LibraryPrices[i].Split(','); Code_ID = line[indCode_ID]; if(Code_ID==PriceID ) { urlplus+="p="+line[indCUP]+":"+qty+"&"; } } } } return urlplus; } public static string AddtoURLMolding(Dictionary Moldingdict){ string urlplus=""; string Code_ID; string Color_ID; foreach (KeyValuePair pair in Moldingdict) { //From Panel List string[] CODE = pair.Key.Split('?'); //Index int indCode_ID=UIT.Ind(Library.Price,Header.Code_ID); int indCUP=4; string MoldingUniqueName=UIT.Value(Library.Molding,CODE[0],Header.Unique_Name).Trim(); string ColorUniqueName=UIT.Value(Library.CabTexture,CODE[1],Header.Unique_Name).Trim(); float LenghtOfOne=DOIT.ConvertStringToNumber(UIT.Value(Library.Molding,CODE[0],Header.Wide)); float qty=Mathf.Ceil(pair.Value/LenghtOfOne); string PriceID = MoldingUniqueName+"-"+ColorUniqueName; print("MoldingUniqueName==="+MoldingUniqueName); print("ColorUniqueName==="+ColorUniqueName); if(_P.ListSwitch["MOLDING_BY_MODEL_COLOR"]){ MoldingUniqueName=UIT.GetMoldingPriceCode_ID(MoldingUniqueName,ColorUniqueName); } //Check on price list for(int i=1; i<_G.UIT_LibraryPrices.Count; i++){ if(!string.IsNullOrEmpty(_G.UIT_LibraryPrices[i])){ string[] line=_G.UIT_LibraryPrices[i].Split(','); Code_ID = line[indCode_ID]; //Variant_ID=line[indVariant_ID]; Color_ID=line[indCUP]; if(Code_ID==PriceID ) { urlplus+="p="+line[indCUP]+":"+qty+"&"; } } } } return urlplus; } public static void ShowEcommeceIcon(){ GameObject Shopify=Get.o2("Canvas/Panel_SCENE/DASH","btnShopify"); GameObject Magento=Get.o2("Canvas/Panel_SCENE/DASH","btnShopingKart"); GameObject PriceShow=Get.o2("Canvas/Panel_SCENE/DASH","PriceShow"); Set.alpha(Shopify,_P.ListSwitch[Pref.SHOPIFY]); Set.alpha(PriceShow,_P.ListSwitch[Pref.SHOW_PRICE]); Set.alpha(Magento,_P.ListSwitch[Pref.MAGENTO]); if(_P.ListSwitch[Pref.SHOW_PRICE]){ Get.o2("Canvas/Panel_SCENE/DASH","btnShopify").transform.localPosition=new(78f,34f,0); Get.o2("Canvas/Panel_SCENE/DASH","btnShopingKart").transform.localPosition=new(78f,35f,0); } } }